Class: SyntaxTree::VCall
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.
-
#value ⇒ Object
readonly
- Ident
-
the value of this expression.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #access_control? ⇒ Boolean
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(_keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ VCall
constructor
A new instance of VCall.
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:, comments: []) ⇒ VCall
Returns a new instance of VCall.
9873 9874 9875 9876 9877 |
# File 'lib/syntax_tree/node.rb', line 9873 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
9871 9872 9873 |
# File 'lib/syntax_tree/node.rb', line 9871 def comments @comments end |
#value ⇒ Object (readonly)
- Ident
-
the value of this expression
9868 9869 9870 |
# File 'lib/syntax_tree/node.rb', line 9868 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
9879 9880 9881 |
# File 'lib/syntax_tree/node.rb', line 9879 def accept(visitor) visitor.visit_vcall(self) end |
#access_control? ⇒ Boolean
9897 9898 9899 |
# File 'lib/syntax_tree/node.rb', line 9897 def access_control? @access_control ||= %w[private protected public].include?(value.value) end |
#child_nodes ⇒ Object Also known as: deconstruct
9883 9884 9885 |
# File 'lib/syntax_tree/node.rb', line 9883 def child_nodes [value] end |
#deconstruct_keys(_keys) ⇒ Object
9889 9890 9891 |
# File 'lib/syntax_tree/node.rb', line 9889 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
9893 9894 9895 |
# File 'lib/syntax_tree/node.rb', line 9893 def format(q) q.format(value) end |