Class: Verto::DSL::Hook
- Inherits:
-
Object
- Object
- Verto::DSL::Hook
- Defined in:
- lib/verto/dsl/hook.rb
Instance Attribute Summary collapse
-
#moment ⇒ Object
Returns the value of attribute moment.
Instance Method Summary collapse
- #call(with_attributes: {}) ⇒ Object
-
#initialize(interpreter: DSL.interpreter, moment: :before, &block) ⇒ Hook
constructor
A new instance of Hook.
Constructor Details
#initialize(interpreter: DSL.interpreter, moment: :before, &block) ⇒ Hook
Returns a new instance of Hook.
8 9 10 11 12 |
# File 'lib/verto/dsl/hook.rb', line 8 def initialize(interpreter: DSL.interpreter, moment: :before, &block) @moment = moment.to_sym @interpreter = interpreter @block = block end |
Instance Attribute Details
#moment ⇒ Object
Returns the value of attribute moment.
6 7 8 |
# File 'lib/verto/dsl/hook.rb', line 6 def moment @moment end |
Instance Method Details
#call(with_attributes: {}) ⇒ Object
14 15 16 |
# File 'lib/verto/dsl/hook.rb', line 14 def call(with_attributes: {}) @interpreter.evaluate(attributes: with_attributes, &@block) end |