Hello,

I think method_missing is not good. because, real error is hidden.

On Thu, May 23, 2002 at 12:20:45PM +0900,
 Jim Freeze wrote:

> puts a.h1("Title") 
> puts a.a({'href'=>'http://mylink'}) { a.h1 { "Title" } }
> puts a.a({'href'=>'http://mylink'}) { a.h1 { "Title" } }, a.br

Isn't this enough?

def a(element, attr = {})
  "<#{element}" + attr.collect{|k,v| %Q< #{k}="#{v}"> }.to_s + ">" +
  if block_given? then yield.to_s + "</#{element}>" else "" end
end

puts a(:h1){ "Title" }
puts a(:a, {'href'=>'http://mylink'}){ a(:h1){ "Title" } }
puts a(:a, {'href'=>'http://mylink'}){ a(:h1){ "Title" } }, a(:br)


-- 
Wakou Aoyama  <wakou / ruby-lang.org>