Sha256: 78593c1e51018b40c0bf19ed8bb439835ce29f81260ff96bcc3fc1e302bb2fda

Contents?: true

Size: 338 Bytes

Versions: 1

Compression:

Stored size: 338 Bytes

Contents

# frozen_string_literal: true

class Rustic::Hooks
  def initialize(config)
    @before = config.before
    @after = config.after
  end

  def with_hooks(arg = nil)
    raise ArgumentError unless block_given?

    @before&.call(arg)
    yield
    @after&.call(arg) # TODO: do not call the after block if an exception was raised
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rustic-0.3.0 lib/rustic/hooks.rb