Skip to content

Instantly share code, notes, and snippets.

@RLGGHC RLGGHC/tinyxml.rb
Created Oct 28, 2009

Embed
What would you like to do?
BasicObject example
# Courtesy David Black
class TinyXML < BasicObject
def method_missing(m, *args, &block)
$stdout << "<#{m}>\n"
if block
$stdout << yield
end
$stdout << "\n</#{m}>"
return
end
end
tx = TinyXML.new
tx.people do
tx.person do
tx.name do
"David"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.