Class: CodeObject::Base
- Inherits:
-
Object
- Object
- CodeObject::Base
- Includes:
- Dom::Node, Parser::MetaContainer, Token::Container
- Defined in:
- lib/code_object/base.rb
Direct Known Subclasses
Constant Summary
Constants included from Dom::Node
Dom::Node::ABSOLUTE, Dom::Node::LEAF, Dom::Node::NODENAME, Dom::Node::NS_SEP, Dom::Node::NS_SEP_STRING, Dom::Node::RELATIVE
Instance Attribute Summary collapse
-
#docs ⇒ Object
Returns the value of attribute docs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Attributes included from Parser::MetaContainer
#filepath, #line_start, #source
Instance Method Summary collapse
-
#initialize(path = "NO_PATH_SPECIFIED") ⇒ Base
constructor
The name instance variable is required by Dom::Node.
- #to_s ⇒ Object
Methods included from Parser::MetaContainer
Methods included from Dom::Node
#[], #add_node, #children, #each_child, #find, #has_children?, #namespace, #parent, #parents, #print_tree, #qualified_name, #resolve, #siblings
Methods included from Token::Container
#add_token, #process_token, #process_tokens, #token, #tokens
Constructor Details
#initialize(path = "NO_PATH_SPECIFIED") ⇒ Base
The name instance variable is required by Dom::Node
21 22 23 24 25 |
# File 'lib/code_object/base.rb', line 21 def initialize(path = "NO_PATH_SPECIFIED") path = path.to_s.split(/\s/).first # remove trailing spaces @path, @name = path, extract_name_from(path) super() end |
Instance Attribute Details
#docs ⇒ Object
Returns the value of attribute docs.
18 19 20 |
# File 'lib/code_object/base.rb', line 18 def docs @docs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/code_object/base.rb', line 18 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
18 19 20 |
# File 'lib/code_object/base.rb', line 18 def path @path end |
Instance Method Details
#to_s ⇒ Object
27 28 29 30 |
# File 'lib/code_object/base.rb', line 27 def to_s token_names = @tokens.keys if @tokens "#<#{self.class}:#{self.name} @parent=#{parent.name if parent} @children=#{@children.keys} @tokens=#{token_names}>" end |