Class: Yoda::AST::RootVnode
- Includes:
- Namespace
- Defined in:
- lib/yoda/ast/root_vnode.rb
Instance Attribute Summary collapse
- #node ⇒ Parser::AST::Node readonly
Attributes inherited from Vnode
Instance Method Summary collapse
- #children ⇒ Array<Vnode>
- #content ⇒ Vnode
- #identifier ⇒ String
-
#initialize(node, comments_by_node: {}) ⇒ RootVnode
constructor
A new instance of RootVnode.
- #parent ⇒ nil
- #source_map ⇒ Parser::Source::Map?
- #type ⇒ Symbol
Methods included from Namespace
#namespace, #namespace?, #namespace_nestings, #parent_namespace, #path, #root?
Methods inherited from Vnode
#constant?, #empty?, #inspect, #inspect_content, #nesting, #present?, #try, #wrap_child
Methods included from Vnode::CommentPositional
#comments_by_vnode, #positionally_nearest_comment, #positionally_nearest_commenting_node
Methods included from Vnode::Positional
#location, #positionally_include?, #positionally_nearest_child, #range
Methods included from Vnode::CommentAssociation
#all_nodes_lazy, #associate_comments, #comments, #wrapping?
Methods included from Traversable
#query, #query_all, #query_ancestor, #query_ancestors
Methods included from MethodTraversable
#calc_current_location_method, #including_method, #method?
Methods included from NamespaceTraversable
#calc_current_location_namespace, #full_name, #namespace, #namespace?, #namespace_path, #root?
Constructor Details
#initialize(node, comments_by_node: {}) ⇒ RootVnode
Returns a new instance of RootVnode.
11 12 13 14 |
# File 'lib/yoda/ast/root_vnode.rb', line 11 def initialize(node, comments_by_node: {}) @node = node @comments_by_node = comments_by_node end |
Instance Attribute Details
#node ⇒ Parser::AST::Node (readonly)
7 8 9 |
# File 'lib/yoda/ast/root_vnode.rb', line 7 def node @node end |
Instance Method Details
#children ⇒ Array<Vnode>
32 33 34 |
# File 'lib/yoda/ast/root_vnode.rb', line 32 def children [content] end |
#content ⇒ Vnode
27 28 29 |
# File 'lib/yoda/ast/root_vnode.rb', line 27 def content @content ||= wrap_child(node) end |
#identifier ⇒ String
37 38 39 |
# File 'lib/yoda/ast/root_vnode.rb', line 37 def identifier "#{type}:#{source_map.expression}" end |
#parent ⇒ nil
17 18 19 |
# File 'lib/yoda/ast/root_vnode.rb', line 17 def parent nil end |
#source_map ⇒ Parser::Source::Map?
42 43 44 |
# File 'lib/yoda/ast/root_vnode.rb', line 42 def source_map node.location end |
#type ⇒ Symbol
22 23 24 |
# File 'lib/yoda/ast/root_vnode.rb', line 22 def type :root end |