Class: SyntaxTree::VCall

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.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

Attributes inherited from Node

#location

Instance Method Summary collapse

Methods inherited from Node

#construct_keys, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:, comments: []) ⇒ VCall



9532
9533
9534
9535
9536
# File 'lib/syntax_tree/node.rb', line 9532

def initialize(value:, location:, comments: [])
  @value = value
  @location = location
  @comments = comments
end

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



9530
9531
9532
# File 'lib/syntax_tree/node.rb', line 9530

def comments
  @comments
end

#valueObject (readonly)

Ident

the value of this expression



9527
9528
9529
# File 'lib/syntax_tree/node.rb', line 9527

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



9538
9539
9540
# File 'lib/syntax_tree/node.rb', line 9538

def accept(visitor)
  visitor.visit_vcall(self)
end

#child_nodesObject Also known as: deconstruct



9542
9543
9544
# File 'lib/syntax_tree/node.rb', line 9542

def child_nodes
  [value]
end

#deconstruct_keys(_keys) ⇒ Object



9548
9549
9550
# File 'lib/syntax_tree/node.rb', line 9548

def deconstruct_keys(_keys)
  { value: value, location: location, comments: comments }
end

#format(q) ⇒ Object



9552
9553
9554
# File 'lib/syntax_tree/node.rb', line 9552

def format(q)
  q.format(value)
end