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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -