Class: SyntaxTree::VCall
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::VCall
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:) ⇒ VCall
11555
11556
11557
11558
11559
|
# File 'lib/syntax_tree/node.rb', line 11555
def initialize(value:, location:)
@value = value
@location = location
= []
end
|
Instance Attribute Details
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
11553
11554
11555
|
# File 'lib/syntax_tree/node.rb', line 11553
def
end
|
#value ⇒ Object
- Ident
-
the value of this expression
11550
11551
11552
|
# File 'lib/syntax_tree/node.rb', line 11550
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
11590
11591
11592
|
# File 'lib/syntax_tree/node.rb', line 11590
def ===(other)
other.is_a?(VCall) && value === other.value
end
|
#accept(visitor) ⇒ Object
11561
11562
11563
|
# File 'lib/syntax_tree/node.rb', line 11561
def accept(visitor)
visitor.visit_vcall(self)
end
|
#access_control? ⇒ Boolean
11594
11595
11596
|
# File 'lib/syntax_tree/node.rb', line 11594
def access_control?
@access_control ||= %w[private protected public].include?(value.value)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
11565
11566
11567
|
# File 'lib/syntax_tree/node.rb', line 11565
def child_nodes
[value]
end
|
#copy(value: nil, location: nil) ⇒ Object
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
|
# File 'lib/syntax_tree/node.rb', line 11569
def copy(value: nil, location: nil)
node =
VCall.new(
value: value || self.value,
location: location || self.location
)
node..concat(.map(&:copy))
node
end
|
#deconstruct_keys(_keys) ⇒ Object
11582
11583
11584
|
# File 'lib/syntax_tree/node.rb', line 11582
def deconstruct_keys(_keys)
{ value: value, location: location, comments: }
end
|
11586
11587
11588
|
# File 'lib/syntax_tree/node.rb', line 11586
def format(q)
q.format(value)
end
|