Module: Trestle::HookHelper

Included in:
Form::Renderer
Defined in:
app/helpers/trestle/hook_helper.rb

Instance Method Summary collapse

Instance Method Details

#hook(name) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/helpers/trestle/hook_helper.rb', line 3

def hook(name)
  if hook?(name)
    safe_join(hooks(name).map { |hook|
      hook.evaluate(self)
    }, "\n")
  elsif block_given?
    capture(&Proc.new)
  end
end

#hook?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/helpers/trestle/hook_helper.rb', line 13

def hook?(name)
  hook_sets.any? { |set| set.any?(name) }
end