Sha256: 9c0b1671a99dee3bceda31944794182dbe3728f81cebf66b90ad2cc4b2ad08fd

Contents?: true

Size: 476 Bytes

Versions: 1

Compression:

Stored size: 476 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.instance_exec {@state_inspector = nil} if obj.
        instance_variable_get(:@state_inspector).
        tap {|h| h.is_a?(Hash) ? h.empty? : h}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
state_inspector-1.0.0.rc1 lib/state_inspector/helper.rb