is it possible to use hash keys as a first level variables inside ruby method? -


i'll try explain myself little bit more

# lets have hash options = {a: 1, b: 2}  # , here i'm calling method some_method(options)  def some_method(options)   # instead of using options[:a] i'd use a.   options.delete_nesting_and_create_vars   + b # :a + :b good. 

thanks!

if options fixed, :a , :b keys, can write method this:

def some_method(a:, b:)   + b end  options = {a: 1, b: 2}  some_method(options) #=> 3 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -