home.social

#keywordarguments — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #keywordarguments, aggregated by home.social.

  1. If you work with Ruby, you've often encountered a situation where a method takes multiple keyword arguments. And you need to pass a hash to it and also add another new argument.
    In most cases, you do the following: create a new hash and pass it as an argument to the method using the double splat operator `**`. But you can do this more concisely: instead of creating a new hash, pass the hash followed by another argument.

    #Ruby #Hash #KeywordArguments #kwargs #Function #Method #DoubleSplat