Class: SyntaxTree::FCall
Overview
FCall represents the piece of a method call that comes before any arguments (i.e., just the name of the method). It is used in places where the parser is sure that it is a method call and not potentially a local variable.
method(argument)
In the above example, it’s referring to the method segment.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
- nil | ArgParen | Args
-
the arguments to the method call.
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- Const | Ident
-
the name of the method.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, arguments:, location:, comments: []) ⇒ FCall
constructor
A new instance of FCall.
Methods inherited from Node
Constructor Details
#initialize(value:, arguments:, location:, comments: []) ⇒ FCall
Returns a new instance of FCall.
3962 3963 3964 3965 3966 3967 |
# File 'lib/syntax_tree/node.rb', line 3962 def initialize(value:, arguments:, location:, comments: []) @value = value @arguments = arguments @location = location @comments = comments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
- nil | ArgParen | Args
-
the arguments to the method call
3957 3958 3959 |
# File 'lib/syntax_tree/node.rb', line 3957 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
3960 3961 3962 |
# File 'lib/syntax_tree/node.rb', line 3960 def comments @comments end |
#value ⇒ Object (readonly)
- Const | Ident
-
the name of the method
3954 3955 3956 |
# File 'lib/syntax_tree/node.rb', line 3954 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
3969 3970 3971 |
# File 'lib/syntax_tree/node.rb', line 3969 def accept(visitor) visitor.visit_fcall(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
3973 3974 3975 |
# File 'lib/syntax_tree/node.rb', line 3973 def child_nodes [value, arguments] end |
#deconstruct_keys(keys) ⇒ Object
3979 3980 3981 3982 3983 3984 3985 3986 |
# File 'lib/syntax_tree/node.rb', line 3979 def deconstruct_keys(keys) { value: value, arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
3988 3989 3990 3991 |
# File 'lib/syntax_tree/node.rb', line 3988 def format(q) q.format(value) q.format(arguments) end |