class Aerogel::Render::BlockHelper
Public Class Methods
new( *args, &block )
click to toggle source
Creates a block helper object. args will be passed to the block as arguments.
# File lib/aerogel/core/render/block_helper.rb, line 14 def initialize( *args, &block ) @args = args @block = block # makes methods and helpers accessible at the self instance scope @self_before_instance_eval = eval "self", @block.binding end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
# File lib/aerogel/core/render/block_helper.rb, line 40 def method_missing(method, *args, &block) @self_before_instance_eval.send method, *args, &block end
render()
click to toggle source
Renders output to the template or returns it as a string.
# File lib/aerogel/core/render/block_helper.rb, line 32 def render content = output_capture(@block) do instance_exec( *@args, &@block ) end content_wrapped = output_capture() { wrap( content ) } output_concat content_wrapped end
wrap( content )
click to toggle source
Wraps captured content with custom tags or text. Most of the time, method should be redefined by descendant class. A good example would be a form helper, that surrounds captured content with <form ..></form> tags.
# File lib/aerogel/core/render/block_helper.rb, line 26 def wrap( content ) content end