Class: Yoda::AST::ConstantNode
- Defined in:
- lib/yoda/ast/constant_node.rb
Instance Attribute Summary
Attributes inherited from Node
Attributes inherited from Vnode
Instance Method Summary collapse
- #absolute? ⇒ true, false
- #base ⇒ Vnode
- #constant? ⇒ Boolean
- #constant_base? ⇒ true, false
- #just_after_separator?(location) ⇒ true, false
- #name ⇒ Vnode
- #path ⇒ Model::Path
- #path_name(base = nil) ⇒ String
Methods inherited from Node
#children, #identifier, #initialize, #kind, #source_map
Methods inherited from Vnode
#children, #empty?, #identifier, #initialize, #inspect, #inspect_content, #nesting, #present?, #try, #type, #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, #source_map
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
This class inherits a constructor from Yoda::AST::Node
Instance Method Details
#absolute? ⇒ true, false
15 16 17 |
# File 'lib/yoda/ast/constant_node.rb', line 15 def absolute? base.absolute? end |
#constant? ⇒ Boolean
24 25 26 |
# File 'lib/yoda/ast/constant_node.rb', line 24 def constant? true end |
#constant_base? ⇒ true, false
20 21 22 |
# File 'lib/yoda/ast/constant_node.rb', line 20 def constant_base? false end |
#just_after_separator?(location) ⇒ true, false
30 31 32 33 |
# File 'lib/yoda/ast/constant_node.rb', line 30 def just_after_separator?(location) return false unless source_map.double_colon location == Parsing::Location.of_ast_location(source_map.double_colon.end) end |
#path ⇒ Model::Path
36 37 38 |
# File 'lib/yoda/ast/constant_node.rb', line 36 def path Model::Path.new(path_name) end |
#path_name(base = nil) ⇒ String
42 43 44 45 46 47 48 49 50 |
# File 'lib/yoda/ast/constant_node.rb', line 42 def path_name(base = nil) if base.nil? || base.empty? name.name.to_s elsif base.constant_base? "#{base.path_name}#{name.name}" else "#{base.path_name}::#{name.name}" end end |