Class: SyntaxTree::Period
Overview
Period represents the use of the . operator. It is usually found in method calls.
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- String
-
the period.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ Period
constructor
A new instance of Period.
Methods inherited from Node
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Period
Returns a new instance of Period.
6774 6775 6776 6777 6778 |
# File 'lib/syntax_tree/node.rb', line 6774 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
6772 6773 6774 |
# File 'lib/syntax_tree/node.rb', line 6772 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the period
6769 6770 6771 |
# File 'lib/syntax_tree/node.rb', line 6769 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
6780 6781 6782 |
# File 'lib/syntax_tree/node.rb', line 6780 def accept(visitor) visitor.visit_period(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
6784 6785 6786 |
# File 'lib/syntax_tree/node.rb', line 6784 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
6790 6791 6792 |
# File 'lib/syntax_tree/node.rb', line 6790 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
6794 6795 6796 |
# File 'lib/syntax_tree/node.rb', line 6794 def format(q) q.text(value) end |