Class: SyntaxTree::VCall
- Inherits:
-
Object
- Object
- SyntaxTree::VCall
- Defined in:
- lib/syntax_tree.rb
Overview
VCall represent any plain named object with Ruby that could be either a local variable or a method call.
variable
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#location ⇒ Object
readonly
- Location
-
the location of this node.
-
#value ⇒ Object
readonly
- Ident
-
the value of this expression.
Instance Method Summary collapse
- #child_nodes ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ VCall
constructor
A new instance of VCall.
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(value:, location:, comments: []) ⇒ VCall
Returns a new instance of VCall.
12359 12360 12361 12362 12363 |
# File 'lib/syntax_tree.rb', line 12359 def initialize(value:, location:, comments: []) @value = value @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
12357 12358 12359 |
# File 'lib/syntax_tree.rb', line 12357 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
12354 12355 12356 |
# File 'lib/syntax_tree.rb', line 12354 def location @location end |
#value ⇒ Object (readonly)
- Ident
-
the value of this expression
12351 12352 12353 |
# File 'lib/syntax_tree.rb', line 12351 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
12365 12366 12367 |
# File 'lib/syntax_tree.rb', line 12365 def child_nodes [value] end |
#format(q) ⇒ Object
12369 12370 12371 |
# File 'lib/syntax_tree.rb', line 12369 def format(q) q.format(value) end |
#pretty_print(q) ⇒ Object
12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 |
# File 'lib/syntax_tree.rb', line 12373 def pretty_print(q) q.group(2, "(", ")") do q.text("vcall") q.breakable q.pp(value) q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
12384 12385 12386 12387 12388 |
# File 'lib/syntax_tree.rb', line 12384 def to_json(*opts) { type: :vcall, value: value, loc: location, cmts: comments }.to_json( *opts ) end |