module Olelo::BlockHelper

Public Instance Methods

blocks() click to toggle source
# File lib/olelo/helper.rb, line 3
def blocks
  @blocks ||= Hash.new('')
end
define_block(name, content = nil, &block) click to toggle source
# File lib/olelo/helper.rb, line 7
def define_block(name, content = nil, &block)
  blocks[name] = block ? block : escape_html(content)
  ''
end
include_block(name) click to toggle source
# File lib/olelo/helper.rb, line 17
def include_block(name)
  wrap_block(name) { render_block(name) }
end
render_block(name) click to toggle source
# File lib/olelo/helper.rb, line 12
def render_block(name)
  block = blocks[name]
  block.respond_to?(:call) ? block.call : block
end
wrap_block(name) { || ... } click to toggle source
# File lib/olelo/helper.rb, line 21
def wrap_block(name)
  with_hooks(name) { yield }.join.html_safe
end