, capture - , . (b) - , title .. , , , , , div, . - :
class FooBoxHelper
include ActionView::Helpers::TagHelper
def title(text)
content_tag(:h2, text)
end
def small(text)
content_tag(:p, text, :class => "small")
end
end
def foo_box(&block)
new_block = Proc.new do
helper = FooBoxHelper.new
block.call(helper)
end
content_tag(:div, capture(&new_block), :class => 'foo_box')
end
, capture? Proc , , , , capture. , , ActionView::Helpers. , !