Class: Crispy::CrispyReceivedMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/crispy/crispy_received_message.rb

Constant Summary collapse

DELEGATABLE_METHODS =
[:method_name, :arguments, :attached_block]
CLASS_NAME =
self.name
PP_HEADER =
"#<#{CLASS_NAME}["
PP_CYCLE =
"#{PP_HEADER}...]>"

Instance Method Summary collapse

Constructor Details

#initialize(method_name, *arguments, &attached_block) ⇒ CrispyReceivedMessage

Returns a new instance of CrispyReceivedMessage.



12
13
14
15
16
# File 'lib/crispy/crispy_received_message.rb', line 12

def initialize method_name, *arguments, &attached_block
  @method_name = method_name
  @arguments = arguments
  @attached_block = attached_block
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
21
22
# File 'lib/crispy/crispy_received_message.rb', line 18

def == other
  @method_name == other.method_name &&
  @arguments == other.arguments # &&
  # @attached_block == other.attached_block
end

#pretty_print(pp) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/crispy/crispy_received_message.rb', line 34

def pretty_print pp
  pp.group 2, PP_HEADER do
    pp.pp @method_name
    pp.text ','.freeze
    pp.breakable
    pp.text '*'.freeze
    pp.pp @arguments
    pp.text ']>'.freeze
  end
end

#pretty_print_cycle(pp) ⇒ Object



47
48
49
# File 'lib/crispy/crispy_received_message.rb', line 47

def pretty_print_cycle pp
  pp.text PP_CYCLE
end

#to_sObject Also known as: inspect



26
27
28
# File 'lib/crispy/crispy_received_message.rb', line 26

def to_s
  "#<#{CLASS_NAME}[#{@method_name.inspect}, *#{@arguments.inspect}]>"
end