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
17 18 19 20 21 |
# File 'lib/code_object/base.rb', line 17 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.
14 15 16 |
# File 'lib/code_object/base.rb', line 14 def docs @docs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/code_object/base.rb', line 14 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
14 15 16 |
# File 'lib/code_object/base.rb', line 14 def path @path end |
Instance Method Details
#display_name ⇒ Object
can be overriden by subclasses
34 35 36 |
# File 'lib/code_object/base.rb', line 34 def display_name @name end |
#to_s ⇒ Object
23 24 25 26 |
# File 'lib/code_object/base.rb', line 23 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 |