Method: Peeek::Hooks#circumvent

Defined in:
lib/peeek/hooks.rb

#circumvent { ... } ⇒ Object

Run process while circumvent the hooks.

Yields:

  • any process that wants to run while circumvent the hooks

Raises:

  • (ArgumentError)


33
34
35
36
37
38
39
40
41
42
43
# File 'lib/peeek/hooks.rb', line 33

def circumvent
  raise ArgumentError, 'block not supplied' unless block_given?

  linked_hooks = select(&:linked?).each(&:unlink)

  begin
    yield
  ensure
    linked_hooks.each(&:link)
  end
end