Class: Rustic::Hooks
- Inherits:
-
Object
- Object
- Rustic::Hooks
- Defined in:
- lib/rustic/hooks.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Hooks
constructor
A new instance of Hooks.
- #with_hooks(arg = nil) ⇒ Object
Constructor Details
#initialize(config) ⇒ Hooks
Returns a new instance of Hooks.
4 5 6 7 |
# File 'lib/rustic/hooks.rb', line 4 def initialize(config) @before = config&.before @after = config&.after end |
Instance Method Details
#with_hooks(arg = nil) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/rustic/hooks.rb', line 9 def with_hooks(arg = nil) raise ArgumentError unless block_given? @before&.call(arg) yield @after&.call(arg) end |