Sha256: c546fc3f1abadf5ce992ef6163d17babbf9a970242c35a4eda7c1e30ec13a2ff

Contents?: true

Size: 321 Bytes

Versions: 5

Compression:

Stored size: 321 Bytes

Contents

module Trestle
  module HookHelper
    def hook(name)
      safe_join(hooks[name.to_s].map { |hook|
        instance_exec(&hook)
      }, "\n") if hook?(name)
    end

    def hook?(name)
      hooks.key?(name.to_s) && hooks[name.to_s].any?
    end

  protected
    def hooks
      Trestle.config.hooks
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trestle-0.8.9 app/helpers/trestle/hook_helper.rb
trestle-0.8.8 app/helpers/trestle/hook_helper.rb
trestle-0.8.7 app/helpers/trestle/hook_helper.rb
trestle-0.8.6 app/helpers/trestle/hook_helper.rb
trestle-0.8.5 app/helpers/trestle/hook_helper.rb