Class: Spy::Collection::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/spy/collection/entry.rb

Overview

Abstraction to isolate domain logic

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



4
5
6
# File 'lib/spy/collection/entry.rb', line 4

def method
  @method
end

#spiedObject

Returns the value of attribute spied

Returns:

  • (Object)

    the current value of spied



4
5
6
# File 'lib/spy/collection/entry.rb', line 4

def spied
  @spied
end

#spyObject

Returns the value of attribute spy

Returns:

  • (Object)

    the current value of spy



4
5
6
# File 'lib/spy/collection/entry.rb', line 4

def spy
  @spy
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/spy/collection/entry.rb', line 10

def ==(other)
  key == other.key
end

#keyObject



5
6
7
8
# File 'lib/spy/collection/entry.rb', line 5

def key
  receiver = method.is_a?(Method) ? method.receiver : nil
  "#{receiver.object_id}|#{method.name}|#{method.class}"
end