Class: LibRubyParser::Nodes::Def
- Inherits:
-
LibRubyParser::Node
- Object
- LibRubyParser::Node
- LibRubyParser::Nodes::Def
- Defined in:
- lib/lib-ruby-parser/nodes.rb
Overview
Represents method definition using def
keyword (not on a singleton, see Defs
node).
Instance Attribute Summary collapse
-
#args ⇒ Node?
readonly
Arguments of a method,
None
if there's no arguments. -
#assignment_l ⇒ Loc?
readonly
Location of the
=
operator for endless method definition. -
#body ⇒ Node?
readonly
Body of a method,
None
if there's no body. -
#end_l ⇒ Loc?
readonly
Location of the
end
keyword. -
#expression_l ⇒ Loc
readonly
Location of the full expression.
-
#keyword_l ⇒ Loc
readonly
Location of the
def
keyword. -
#name ⇒ String
readonly
Name of the method,
String("foo")
fordef foo; end
. -
#name_l ⇒ Loc
readonly
Location of the method name.
Instance Attribute Details
#args ⇒ Node? (readonly)
Arguments of a method, None
if there's no arguments.
All information about parentheses around arguments is stored in this node.
1011 1012 1013 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1011 def args @args end |
#assignment_l ⇒ Loc? (readonly)
Location of the =
operator for endless method definition
def m() = 1
~
None
for regular method definition
1055 1056 1057 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1055 def assignment_l @assignment_l end |
#body ⇒ Node? (readonly)
Body of a method, None
if there's no body.
1015 1016 1017 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1015 def body @body end |
#end_l ⇒ Loc? (readonly)
Location of the end
keyword.
def foo; end
~~~
None
for endless method definition
1044 1045 1046 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1044 def end_l @end_l end |
#expression_l ⇒ Loc (readonly)
Location of the full expression
def m(a); foo; end
~~~~~~~~~~~~~~~~~~
1064 1065 1066 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1064 def expression_l @expression_l end |
#keyword_l ⇒ Loc (readonly)
Location of the def
keyword.
def foo; end
~~~
1024 1025 1026 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1024 def keyword_l @keyword_l end |
#name ⇒ String (readonly)
Name of the method, String("foo")
for def foo; end
1005 1006 1007 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1005 def name @name end |
#name_l ⇒ Loc (readonly)
Location of the method name.
def foo; end
~~~
1033 1034 1035 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1033 def name_l @name_l end |