From: Aashish Kiran Date: 2013-03-13T21:30:22+09:00 Subject: cannot get blocks working Hi, Below is the piece of code. Can anyone help in getting expected output. ------------------------------------------------------------ class XmlDoc def method_missing(name, *args, &block) self.class.class_eval do define_method(name) do |*args, &block| if block_given? temp = "<#{name}#{temp}>" + block.call + "" else "<#{name}>" end end end send(name, *args, &block) end end x = XmlDoc.new p '1111111111111111111' p x.hello #expected output "" p x.hello{"dolly"} #expected output "dolly" ----------------------------------------------------------------------- Thanks, Aashish -- Posted via http://www.ruby-forum.com/.