Class: SyntaxTree::RBS::Root
- Inherits:
-
Object
- Object
- SyntaxTree::RBS::Root
- Defined in:
- lib/syntax_tree/rbs.rb
Overview
This is the root node of the entire tree. It contains all of the top-level declarations within the file.
Instance Attribute Summary collapse
-
#declarations ⇒ Object
readonly
Returns the value of attribute declarations.
Instance Method Summary collapse
- #format(q) ⇒ Object
-
#initialize(declarations) ⇒ Root
constructor
A new instance of Root.
- #pretty_print(q) ⇒ Object
Constructor Details
#initialize(declarations) ⇒ Root
Returns a new instance of Root.
47 48 49 |
# File 'lib/syntax_tree/rbs.rb', line 47 def initialize(declarations) @declarations = declarations end |
Instance Attribute Details
#declarations ⇒ Object (readonly)
Returns the value of attribute declarations.
45 46 47 |
# File 'lib/syntax_tree/rbs.rb', line 45 def declarations @declarations end |
Instance Method Details
#format(q) ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/syntax_tree/rbs.rb', line 51 def format(q) separator = lambda do q.breakable(force: true) q.breakable(force: true) end q.seplist(declarations, separator) { |declaration| declaration.format(q) } q.breakable(force: true) end |
#pretty_print(q) ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/syntax_tree/rbs.rb', line 62 def pretty_print(q) q.group(2, "(root", ")") do q.breakable q.text("declarations=") q.pp(declarations) end end |