Sha256: 3932b2012c405fdbdd8ffc09fc72785996340af7555ee9e5e8474af31e9d817e
Contents?: true
Size: 685 Bytes
Versions: 5
Compression:
Stored size: 685 Bytes
Contents
module Trestle class Hook module Helpers def hook(name, *args, &block) hooks = hooks(name) if hooks.any? safe_join(hooks.map { |hook| hook.evaluate(self, *args) }, "\n") elsif block_given? capture(*args, &block) 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 end
Version data entries
5 entries across 5 versions & 1 rubygems