class Loom::Pattern::Hook

Attributes

block[R]
scope[R]

Public Class Methods

after_hooks(hooks) click to toggle source
# File lib/loom/pattern/hook.rb, line 13
def after_hooks(hooks)
  hooks.find_all { |h| h.scope == :after }
end
around_hooks(hooks) click to toggle source
# File lib/loom/pattern/hook.rb, line 5
def around_hooks(hooks)
  hooks.find_all { |h| h.scope == :around }
end
before_hooks(hooks) click to toggle source
# File lib/loom/pattern/hook.rb, line 9
def before_hooks(hooks)
  hooks.find_all { |h| h.scope == :before }
end
new(scope, &block) click to toggle source
# File lib/loom/pattern/hook.rb, line 18
def initialize(scope, &block)
  unless [:before, :around, :after].include? scope
    raise 'invalid Pattern::DSL hook scope'
  end
  @scope = scope
  @block = block
end