diff options
author | Justin <jevaniew@kanayo.com> | 2016-04-19 09:49:55 -0300 |
---|---|---|
committer | Justin <jevaniew@kanayo.com> | 2016-04-19 09:49:55 -0300 |
commit | b00c69cd1f0b0143ad8e6b92c982c106845583c7 (patch) | |
tree | 7fa1f788627562adc05b4bc96a70d70e396090ac | |
parent | 976410709997b69a2c33fd912a8665d85ab1f2c9 (diff) | |
download | rails-b00c69cd1f0b0143ad8e6b92c982c106845583c7.tar.gz rails-b00c69cd1f0b0143ad8e6b92c982c106845583c7.tar.bz2 rails-b00c69cd1f0b0143ad8e6b92c982c106845583c7.zip |
Change the Hash.to_xml with a lamda example
Update 'foo'.to_xml(lambda { |options, key| options[:builder].b(key) })
to {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/conversions.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb index 6741e732f0..dd5ebe6d8d 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -31,7 +31,7 @@ class Hash # with +key+ as <tt>:root</tt>, and +key+ singularized as second argument. The # callable can add nodes by using <tt>options[:builder]</tt>. # - # 'foo'.to_xml(lambda { |options, key| options[:builder].b(key) }) + # {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml # # => "<b>foo</b>" # # * If +value+ responds to +to_xml+ the method is invoked with +key+ as <tt>:root</tt>. |