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 + "</#{name}>" else "<#{name}></#{name}>" end end end send(name, *args, &block) end end x = XmlDoc.new p '1111111111111111111' p x.hello #expected output "<hello></hello>" p x.hello{"dolly"} #expected output "<hello>dolly</hello>" ----------------------------------------------------------------------- Thanks, Aashish -- Posted via http://www.ruby-forum.com/.