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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Period
Returns a new instance of Period.
6985 6986 6987 6988 6989 |
# File 'lib/syntax_tree/node.rb', line 6985 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
6983 6984 6985 |
# File 'lib/syntax_tree/node.rb', line 6983 def comments @comments end |
#value ⇒ Object (readonly)
[String] the period
6980 6981 6982 |
# File 'lib/syntax_tree/node.rb', line 6980 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
6991 6992 6993 |
# File 'lib/syntax_tree/node.rb', line 6991 def accept(visitor) visitor.visit_period(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
6995 6996 6997 |
# File 'lib/syntax_tree/node.rb', line 6995 def child_nodes [] end |
#deconstruct_keys(_keys) ⇒ Object
7001 7002 7003 |
# File 'lib/syntax_tree/node.rb', line 7001 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
7005 7006 7007 |
# File 'lib/syntax_tree/node.rb', line 7005 def format(q) q.text(value) end |