Learnt this from Avdi Grimm's Ruby Tapas
def content_for(tag, content = yield)
"<%s>%s</%s>" % [tag, content, tag]
end
content_for("p", "hi")
=> "<p>hi</p>"
content_for("p") { "hi" }
=> "<p>hi</p>"
Learnt this from Avdi Grimm's Ruby Tapas
def content_for(tag, content = yield)
"<%s>%s</%s>" % [tag, content, tag]
end
content_for("p", "hi")
=> "<p>hi</p>"
content_for("p") { "hi" }
=> "<p>hi</p>"