Sha256: 0ec26b07a3fd682afa55a2a029902b651b70372eb3ec756113f6f4a0c2f0a8cd
Contents?: true
Size: 596 Bytes
Versions: 4
Compression:
Stored size: 596 Bytes
Contents
module Trestle module HookHelper def hook(name) if hook?(name) safe_join(hooks(name).map { |hook| hook.evaluate(self) }, "\n") elsif block_given? capture(&Proc.new) end end def hook?(name) hook_sets.any? { |set| set.any?(name) } 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
4 entries across 4 versions & 1 rubygems