Sha256: 44b1d1a4fe9fce3e2756f6e25dcb64996f3f723608d2c2884ee55067ab78a27d

Contents?: true

Size: 724 Bytes

Versions: 11

Compression:

Stored size: 724 Bytes

Contents

module Mocha
  class ImpersonatingName
    def initialize(object)
      @object = object
    end

    def mocha_inspect
      @object.mocha_inspect
    end
  end

  class ImpersonatingAnyInstanceName
    def initialize(klass)
      @klass = klass
    end

    def mocha_inspect
      "#<AnyInstance:#{@klass.mocha_inspect}>"
    end
  end

  class Name
    def initialize(name)
      @name = name.to_s
    end

    def mocha_inspect
      "#<Mock:#{@name}>"
    end
  end

  class DefaultName
    def initialize(mock)
      @mock = mock
    end

    def mocha_inspect
      address = @mock.__id__ * 2
      address += 0x100000000 if address < 0
      "#<Mock:0x#{format('%<address>x', address: address)}>"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mocha-2.5.0 lib/mocha/names.rb
mocha-2.4.5 lib/mocha/names.rb
mocha-2.4.4 lib/mocha/names.rb
mocha-2.4.3 lib/mocha/names.rb
mocha-2.4.2 lib/mocha/names.rb
mocha-2.4.1 lib/mocha/names.rb
mocha-2.4.0 lib/mocha/names.rb
mocha-2.2.0 lib/mocha/names.rb
mocha-2.1.0 lib/mocha/names.rb
mocha-2.0.4 lib/mocha/names.rb
mocha-2.0.3 lib/mocha/names.rb