Sha256: 550af52fa52593c328155037968773b35e68445ec054b9a4c06404c6ec13323e

Contents?: true

Size: 431 Bytes

Versions: 3

Compression:

Stored size: 431 Bytes

Contents

module StateInspector
  module Helper
    def toggle_snoop(obj)
      obj.toggle_informant
      yield
    ensure
      obj.toggle_informant
    end

    def toggle_snoop_clean(obj)
      obj.state_inspector.skip_setter_snoops
      obj.toggle_informant
      yield
    ensure
      obj.toggle_informant
      (obj.respond_to?(:class_eval) ? obj : obj.class).
        remove_instance_variable(:@state_inspector) 
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
state_inspector-1.0.2 lib/state_inspector/helper.rb
state_inspector-1.0.1 lib/state_inspector/helper.rb
state_inspector-1.0.0 lib/state_inspector/helper.rb