Class: CodeObject::Base
- Inherits:
-
Object
- Object
- CodeObject::Base
- Includes:
- Dom::Node, Parser::MetaContainer, Token::Container
- Defined in:
- lib/code_object/base.rb
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
-
#display_name ⇒ Object
can be overriden by subclasses.
-
#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
31 32 33 34 35 |
# File 'lib/code_object/base.rb', line 31 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.
28 29 30 |
# File 'lib/code_object/base.rb', line 28 def docs @docs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/code_object/base.rb', line 28 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
28 29 30 |
# File 'lib/code_object/base.rb', line 28 def path @path end |
Instance Method Details
#display_name ⇒ Object
can be overriden by subclasses
48 49 50 |
# File 'lib/code_object/base.rb', line 48 def display_name @name end |
#to_s ⇒ Object
37 38 39 40 |
# File 'lib/code_object/base.rb', line 37 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 |