class Rustic::Hooks

Public Class Methods

new(config) click to toggle source
# File lib/rustic/hooks.rb, line 4
def initialize(config)
  @before = config&.before
  @after = config&.after
end

Public Instance Methods

with_hooks(arg = nil) { || ... } click to toggle source
# 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