Class: ObjectProtocol::SentMessage
- Inherits:
-
Object
- Object
- ObjectProtocol::SentMessage
- Defined in:
- lib/object_protocol/sent_message.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #arguments_passed? ⇒ Boolean
-
#initialize(sender:, receiver:, name:) ⇒ SentMessage
constructor
A new instance of SentMessage.
- #inspect ⇒ Object
- #with(arguments) ⇒ Object
Constructor Details
#initialize(sender:, receiver:, name:) ⇒ SentMessage
Returns a new instance of SentMessage.
5 6 7 8 9 10 11 |
# File 'lib/object_protocol/sent_message.rb', line 5 def initialize(sender:, receiver:, name:) @sender = sender @receiver = receiver @name = name @arguments_passed = false end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
3 4 5 |
# File 'lib/object_protocol/sent_message.rb', line 3 def arguments @arguments end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/object_protocol/sent_message.rb', line 3 def name @name end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
3 4 5 |
# File 'lib/object_protocol/sent_message.rb', line 3 def receiver @receiver end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
3 4 5 |
# File 'lib/object_protocol/sent_message.rb', line 3 def sender @sender end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/object_protocol/sent_message.rb', line 29 def ==(other) other.respond_to?(:sender) && sender == other.sender && other.respond_to?(:receiver) && receiver == other.receiver && other.respond_to?(:name) && name == other.name && other.respond_to?(:arguments) && arguments == other.arguments end |
#arguments_passed? ⇒ Boolean
13 14 15 |
# File 'lib/object_protocol/sent_message.rb', line 13 def arguments_passed? !!@arguments_passed end |
#inspect ⇒ Object
25 26 27 |
# File 'lib/object_protocol/sent_message.rb', line 25 def inspect "<#{self.class.name}[#{sender.class.name}, :#{name}, #{receiver.class.name}]>" end |
#with(arguments) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/object_protocol/sent_message.rb', line 17 def with(arguments) @arguments = arguments @arguments_passed = true self end |