Sha256: fb8498e380cebe0ad4d37b6d67e1ea7ed6d1bf68b215e18e99b061fc0152d220
Contents?: true
Size: 705 Bytes
Versions: 3
Compression:
Stored size: 705 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.respond_to?(:hooks)), Trestle.config.hooks ].compact end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.10.0 | lib/trestle/hook/helpers.rb |
trestle-0.10.0.pre2 | lib/trestle/hook/helpers.rb |
trestle-0.10.0.pre | lib/trestle/hook/helpers.rb |