Class: LibRubyParser::Nodes::CSend

Inherits:
LibRubyParser::Node show all
Defined in:
lib/lib-ruby-parser/nodes.rb

Overview

Represents conditional method call using &. operator

Instance Attribute Summary collapse

Instance Attribute Details

#args::Array<Node> (readonly)

List of arguments

foo&.bar(42)
# and also setters like
foo&.bar = 42

Returns:



879
880
881
# File 'lib/lib-ruby-parser/nodes.rb', line 879

def args
  @args
end

#begin_lLoc? (readonly)

Location of the open parenthesis

foo&.bar(42)
        ~

None if there are no parentheses

Returns:



910
911
912
# File 'lib/lib-ruby-parser/nodes.rb', line 910

def begin_l
  @begin_l
end

#dot_lLoc (readonly)

Location of the &. operator

foo&.bar
   ~~

Returns:



888
889
890
# File 'lib/lib-ruby-parser/nodes.rb', line 888

def dot_l
  @dot_l
end

#end_lLoc? (readonly)

Location of the closing parenthesis

foo&.bar(42)
           ~

None if there are no parentheses

Returns:



921
922
923
# File 'lib/lib-ruby-parser/nodes.rb', line 921

def end_l
  @end_l
end

#expression_lLoc (readonly)

Location of the full expression

foo&.bar(42)
~~~~~~~~~~~~

Returns:



941
942
943
# File 'lib/lib-ruby-parser/nodes.rb', line 941

def expression_l
  @expression_l
end

#method_nameString (readonly)

Name of the method, String("foo") for 1&.foo

Returns:

  • (String)


869
870
871
# File 'lib/lib-ruby-parser/nodes.rb', line 869

def method_name
  @method_name
end

#operator_lLoc? (readonly)

Location of the operator if CSend is a part of assignment like

foo&.bar = 1
         ~

None for a regular call.

Returns:



932
933
934
# File 'lib/lib-ruby-parser/nodes.rb', line 932

def operator_l
  @operator_l
end

#recvNode (readonly)

Receiver of the method call, Int("1") for 1&.foo

Returns:



865
866
867
# File 'lib/lib-ruby-parser/nodes.rb', line 865

def recv
  @recv
end

#selector_lLoc? (readonly)

Location of the method name

foo&.bar(42)
     ~~~

None in a very special case when method call is implicit (i.e. foo&.())

Returns:



899
900
901
# File 'lib/lib-ruby-parser/nodes.rb', line 899

def selector_l
  @selector_l
end