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
This commit is contained in:
Justin 2016-04-19 09:49:55 -03:00
parent 9764107099
commit b00c69cd1f

@ -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>.