Class: SyntaxTree::Command
Overview
Command represents a method call with arguments and no parentheses. Note that Command nodes only happen when there is no explicit receiver for this method.
method argument
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
- Args
-
the arguments being sent with the message.
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#message ⇒ Object
readonly
- Const | Ident
-
the message being sent to the implicit receiver.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(_keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(message:, arguments:, location:, comments: []) ⇒ Command
constructor
A new instance of Command.
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(message:, arguments:, location:, comments: []) ⇒ Command
Returns a new instance of Command.
3052 3053 3054 3055 3056 3057 |
# File 'lib/syntax_tree/node.rb', line 3052 def initialize(message:, arguments:, location:, comments: []) = @arguments = arguments @location = location @comments = comments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
- Args
-
the arguments being sent with the message
3047 3048 3049 |
# File 'lib/syntax_tree/node.rb', line 3047 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
3050 3051 3052 |
# File 'lib/syntax_tree/node.rb', line 3050 def comments @comments end |
#message ⇒ Object (readonly)
- Const | Ident
-
the message being sent to the implicit receiver
3044 3045 3046 |
# File 'lib/syntax_tree/node.rb', line 3044 def end |
Instance Method Details
#accept(visitor) ⇒ Object
3059 3060 3061 |
# File 'lib/syntax_tree/node.rb', line 3059 def accept(visitor) visitor.visit_command(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
3063 3064 3065 |
# File 'lib/syntax_tree/node.rb', line 3063 def child_nodes [, arguments] end |
#deconstruct_keys(_keys) ⇒ Object
3069 3070 3071 3072 3073 3074 3075 3076 |
# File 'lib/syntax_tree/node.rb', line 3069 def deconstruct_keys(_keys) { message: , arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
3078 3079 3080 3081 3082 3083 |
# File 'lib/syntax_tree/node.rb', line 3078 def format(q) q.group do q.format() align(q, self) { q.format(arguments) } end end |