1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #24626 from JustinJruby/master

Change the Hash.to_xml with a lamda example
This commit is contained in:
Jon Moss 2016-04-19 09:22:46 -04:00
commit ad955470b7

View file

@ -31,7 +31,7 @@ class Hash
# with +key+ as <tt>:root</tt>, and +key+ singularized as second argument. The # with +key+ as <tt>:root</tt>, and +key+ singularized as second argument. The
# callable can add nodes by using <tt>options[:builder]</tt>. # 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>" # # => "<b>foo</b>"
# #
# * If +value+ responds to +to_xml+ the method is invoked with +key+ as <tt>:root</tt>. # * If +value+ responds to +to_xml+ the method is invoked with +key+ as <tt>:root</tt>.