Class: LibRubyParser::Nodes::Defs

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

Overview

Represents a singleton method definition (i.e. def self.foo; end)

Instance Attribute Summary collapse

Instance Attribute Details

#argsNode? (readonly)

Arguments of a method, None if there's no arguments.

All information about parentheses around arguments is stored in this node.

Returns:



1130
1131
1132
# File 'lib/lib-ruby-parser/nodes.rb', line 1130

def args
  @args
end

#assignment_lLoc? (readonly)

Location of the = operator for endless method definition

def self.foo() = 42
               ~

None for regular method definition

Returns:



1172
1173
1174
# File 'lib/lib-ruby-parser/nodes.rb', line 1172

def assignment_l
  @assignment_l
end

#bodyNode? (readonly)

Body of the method, None if there's no body.

Returns:



1134
1135
1136
# File 'lib/lib-ruby-parser/nodes.rb', line 1134

def body
  @body
end

#defineeNode (readonly)

Definee of a method definition, Lvar("x") for def x.foo; end

Returns:



1120
1121
1122
# File 'lib/lib-ruby-parser/nodes.rb', line 1120

def definee
  @definee
end

#end_lLoc? (readonly)

Location of the end keyword

def self.foo; end
              ~~~

None for endless method definition

Returns:



1183
1184
1185
# File 'lib/lib-ruby-parser/nodes.rb', line 1183

def end_l
  @end_l
end

#expression_lLoc (readonly)

Location of the full expression

def self.foo; end
~~~~~~~~~~~~~~~~~

Returns:



1192
1193
1194
# File 'lib/lib-ruby-parser/nodes.rb', line 1192

def expression_l
  @expression_l
end

#keyword_lLoc (readonly)

Location of the def keyword

def self.foo; end
~~~

Returns:



1143
1144
1145
# File 'lib/lib-ruby-parser/nodes.rb', line 1143

def keyword_l
  @keyword_l
end

#nameString (readonly)

Name of the method, String("foo") for def x.foo; end

Returns:

  • (String)


1124
1125
1126
# File 'lib/lib-ruby-parser/nodes.rb', line 1124

def name
  @name
end

#name_lLoc (readonly)

Location of the method name

def self.foo; end
         ~~~

Returns:



1161
1162
1163
# File 'lib/lib-ruby-parser/nodes.rb', line 1161

def name_l
  @name_l
end

#operator_lLoc (readonly)

Location of the .

def self.foo; end
        ~

Returns:



1152
1153
1154
# File 'lib/lib-ruby-parser/nodes.rb', line 1152

def operator_l
  @operator_l
end