Class: SchemaMonkey::Tool::Stack::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/schema_monkey/tool/stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stack, mod) ⇒ Hook

Returns a new instance of Hook.



52
53
54
55
# File 'lib/schema_monkey/tool/stack.rb', line 52

def initialize(stack, mod)
  @stack = stack
  singleton_class.send :include, mod
end

Instance Attribute Details

#_nextObject

Returns the value of attribute _next.



50
51
52
# File 'lib/schema_monkey/tool/stack.rb', line 50

def _next
  @_next
end

Instance Method Details

#_call(env) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/schema_monkey/tool/stack.rb', line 57

def _call(env)
  if respond_to? :around
    around(env) { |env|
      _continue env
    }
  else
    _continue env
  end
end

#_continue(env) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/schema_monkey/tool/stack.rb', line 67

def _continue(env)
  if self._next
    self._next._call(env)
  else
    @stack.call_implementation(env)
  end
end