class SyntaxTree::VCall

VCall represent any plain named object with Ruby that could be either a local variable or a method call.

variable

Attributes

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

value[R]
Ident

the value of this expression

Public Class Methods

new(value:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 11723
def initialize(value:, location:)
  @value = value
  @location = location
  @comments = []
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 11758
def ===(other)
  other.is_a?(VCall) && value === other.value
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 11729
def accept(visitor)
  visitor.visit_vcall(self)
end
access_control?() click to toggle source
# File lib/syntax_tree/node.rb, line 11762
def access_control?
  @access_control ||= %w[private protected public].include?(value.value)
end
arity() click to toggle source
# File lib/syntax_tree/node.rb, line 11766
def arity
  0
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 11733
def child_nodes
  [value]
end
Also aliased as: deconstruct
copy(value: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 11737
def copy(value: nil, location: nil)
  node =
    VCall.new(
      value: value || self.value,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 11750
def deconstruct_keys(_keys)
  { value: value, location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 11754
def format(q)
  q.format(value)
end