Class: ObjectProtocol::StandIn

Inherits:
Object
  • Object
show all
Defined in:
lib/object_protocol/stand_in.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(protocol:, name:) ⇒ StandIn

Returns a new instance of StandIn.



7
8
9
10
# File 'lib/object_protocol/stand_in.rb', line 7

def initialize(protocol:, name:)
  @protocol = protocol
  @name     = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/object_protocol/stand_in.rb', line 5

def name
  @name
end

Instance Method Details

#sends(message) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/object_protocol/stand_in.rb', line 12

def sends(message)
  MessageExpectation.new(
    protocol: protocol,
    sender:   self,
    message:  message
  ).tap(&protocol.method(:add_expectation))
end