Class: LibRubyParser::Nodes::Def

Inherits:
LibRubyParser::Node show all
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

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:



1011
1012
1013
# File 'lib/lib-ruby-parser/nodes.rb', line 1011

def args
  @args
end

#assignment_lLoc? (readonly)

Location of the ‘=` operator for endless method definition

“‘text def m() = 1

~

“‘

None for regular method definition

Returns:



1055
1056
1057
# File 'lib/lib-ruby-parser/nodes.rb', line 1055

def assignment_l
  @assignment_l
end

#bodyNode? (readonly)

Body of a method, None if there’s no body.

Returns:



1015
1016
1017
# File 'lib/lib-ruby-parser/nodes.rb', line 1015

def body
  @body
end

#end_lLoc? (readonly)

Location of the end keyword.

“‘text def foo; end

~~~

“‘

None for endless method definition

Returns:



1044
1045
1046
# File 'lib/lib-ruby-parser/nodes.rb', line 1044

def end_l
  @end_l
end

#expression_lLoc (readonly)

Location of the full expression

“‘text def m(a); foo; end ~~~~~~~~~~~~~~~~~~ “`

Returns:



1064
1065
1066
# File 'lib/lib-ruby-parser/nodes.rb', line 1064

def expression_l
  @expression_l
end

#keyword_lLoc (readonly)

Location of the def keyword.

“‘text def foo; end ~~~ “`

Returns:



1024
1025
1026
# File 'lib/lib-ruby-parser/nodes.rb', line 1024

def keyword_l
  @keyword_l
end

#nameString (readonly)

Name of the method, ‘String(“foo”)` for `def foo; end`

Returns:

  • (String)


1005
1006
1007
# File 'lib/lib-ruby-parser/nodes.rb', line 1005

def name
  @name
end

#name_lLoc (readonly)

Location of the method name.

“‘text def foo; end

~~~

“‘

Returns:



1033
1034
1035
# File 'lib/lib-ruby-parser/nodes.rb', line 1033

def name_l
  @name_l
end