Sha256: 9df8765aedba302910b5832c8be3bdcb904b3c63f9ac73bb494a1bb1b4eccd09

Contents?: true

Size: 1.78 KB

Versions: 9

Compression:

Stored size: 1.78 KB

Contents

class TestAdapter < Looksee::Adapter::Base
  module Mixin
    def use_test_adapter
      before { Looksee.adapter = TestAdapter.new }
      after { Looksee.adapter = NATIVE_ADAPTER }
    end
  end

  def lookup_modules(object)
    ancestors[object]
  end

  def internal_public_instance_methods(mod)
    public_methods[mod]
  end

  def internal_protected_instance_methods(mod)
    protected_methods[mod]
  end

  def internal_private_instance_methods(mod)
    private_methods[mod]
  end

  def internal_undefined_instance_methods(mod)
    undefined_methods[mod]
  end

  def included_class?(object)
    NATIVE_ADAPTER.included_class?(object)
  end

  def singleton_class?(object)
    NATIVE_ADAPTER.singleton_class?(object)
  end

  def singleton_instance(object)
    NATIVE_ADAPTER.singleton_instance(object)
  end

  def module_name(object)
    NATIVE_ADAPTER.module_name(object)
  end

  def set_methods(mod, public, protected, private, undefined)
    self.public_methods[mod] = public
    self.protected_methods[mod] = protected
    self.private_methods[mod] = private
    self.undefined_methods[mod] = undefined
  end

  def source_location(method)
    source_locations[[method.owner.name.to_s, method.name.to_s]]
  end

  def set_source_location(mod, method, location)
    source_locations[[mod.name.to_s, method.to_s]] = location
  end

  def ancestors
    @ancestors ||= Hash.new { |h, k| h[k] = [] }
  end

  def public_methods
    @public_methods ||= Hash.new { |h, k| h[k] = [] }
  end

  def protected_methods
    @protected_methods ||= Hash.new { |h, k| h[k] = [] }
  end

  def private_methods
    @private_methods ||= Hash.new { |h, k| h[k] = [] }
  end

  def undefined_methods
    @undefined_methods ||= Hash.new { |h, k| h[k] = [] }
  end

  def source_locations
    @source_locations ||= {}
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
looksee-3.1.1 spec/support/test_adapter.rb
looksee-3.1.0-universal-java-1.8 spec/support/test_adapter.rb
looksee-3.1.0 spec/support/test_adapter.rb
looksee-3.0.1-universal-java-1.8 spec/support/test_adapter.rb
looksee-3.0.1 spec/support/test_adapter.rb
looksee-3.0.0-universal-java-1.8 spec/support/test_adapter.rb
looksee-3.0.0 spec/support/test_adapter.rb
looksee-2.1.1-universal-java-1.6 spec/support/test_adapter.rb
looksee-2.1.1 spec/support/test_adapter.rb