Monday, February 25, 2013

Keyword arguments.

Thank god.

# Ruby 1.9: # (From action_view/helpers/text_helper.rb) def cycle(first_value, *values) options = values.extract_options! name = options.fetch(:name, 'default') # ... end # Ruby 2.0: def cycle(first_value, *values, name: 'default') # ... end

More http://blog.marc-andre.ca/2013/02/23/ruby-2-by-example/


Enhanced by Zemanta

No comments: