Sha256: 69ea3cbd4fef0e16084eb2f373fbc6b85bd23415cc04f9bd281372dd842131c7
Contents?: true
Size: 614 Bytes
Versions: 1
Compression:
Stored size: 614 Bytes
Contents
module Trestle module HookHelper def hook(name, *args) hooks = hooks(name) if hooks.any? safe_join(hooks.map { |hook| hook.evaluate(self, *args) }, "\n") elsif block_given? capture(*args, &Proc.new) end end def hook?(name) hooks(name).any? end protected def hooks(name) hook_sets.map { |set| set.for(name) }.inject(&:+).select { |h| h.visible?(self) } end def hook_sets @_hook_sets ||= [ (admin.hooks if defined?(admin) && admin), Trestle.config.hooks ].compact end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.9.3 | app/helpers/trestle/hook_helper.rb |