Class: Crispy::CrispyReceivedMessageWithReceiver
- Inherits:
-
Object
- Object
- Crispy::CrispyReceivedMessageWithReceiver
- Defined in:
- lib/crispy/crispy_received_message_with_receiver.rb
Constant Summary collapse
- CLASS_NAME =
self.name
- PP_HEADER =
"#<#{CLASS_NAME}["
- PP_CYCLE =
"#{PP_HEADER}...]>"
Instance Attribute Summary collapse
-
#received_message ⇒ Object
readonly
Returns the value of attribute received_message.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(receiver, method_name, *arguments, &attached_block) ⇒ CrispyReceivedMessageWithReceiver
constructor
A new instance of CrispyReceivedMessageWithReceiver.
- #pretty_print(pp) ⇒ Object
- #pretty_print_cycle(pp) ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(receiver, method_name, *arguments, &attached_block) ⇒ CrispyReceivedMessageWithReceiver
Returns a new instance of CrispyReceivedMessageWithReceiver.
19 20 21 22 |
# File 'lib/crispy/crispy_received_message_with_receiver.rb', line 19 def initialize receiver, method_name, *arguments, &attached_block @received_message = CrispyReceivedMessage.new(method_name, *arguments, &attached_block) @receiver = receiver end |
Instance Attribute Details
#received_message ⇒ Object (readonly)
Returns the value of attribute received_message.
5 6 7 |
# File 'lib/crispy/crispy_received_message_with_receiver.rb', line 5 def @received_message end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
5 6 7 |
# File 'lib/crispy/crispy_received_message_with_receiver.rb', line 5 def receiver @receiver end |
Instance Method Details
#==(other) ⇒ Object
24 25 26 |
# File 'lib/crispy/crispy_received_message_with_receiver.rb', line 24 def == other @receiver == other.receiver && @received_message == other. end |
#pretty_print(pp) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/crispy/crispy_received_message_with_receiver.rb', line 38 def pretty_print pp pp.group 2, PP_HEADER do pp.pp @receiver pp.text ','.freeze pp.breakable pp.pp @received_message.method_name pp.text ','.freeze pp.breakable pp.text '*'.freeze pp.pp @received_message.arguments pp.text ']>'.freeze end end |
#pretty_print_cycle(pp) ⇒ Object
56 57 58 |
# File 'lib/crispy/crispy_received_message_with_receiver.rb', line 56 def pretty_print_cycle pp pp.text PP_CYCLE end |
#to_s ⇒ Object Also known as: inspect
30 31 32 |
# File 'lib/crispy/crispy_received_message_with_receiver.rb', line 30 def to_s "#<#{CLASS_NAME}[#{@receiver.inspect}, #{(@received_message.method_name).inspect}, *#{@received_message.arguments.inspect}]>" end |