File: library_hooks.rb

package info (click to toggle)
ruby-vcr 6.0.0%2Breally5.0.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,320 kB
  • sloc: ruby: 8,456; sh: 177; makefile: 7
file content (18 lines) | stat: -rw-r--r-- 298 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module VCR
  # @private
  class LibraryHooks
    attr_accessor :exclusive_hook

    def disabled?(hook)
      ![nil, hook].include?(exclusive_hook)
    end

    def exclusively_enabled(hook)
      self.exclusive_hook = hook
      yield
    ensure
      self.exclusive_hook = nil
    end
  end
end