Class: Doxyparser::Node
Overview
A Node can be any member of the tree-like structure of a C/C++ header file. examples are namespaces, classes, methods, params, etc
Instance Attribute Summary collapse
-
#basename ⇒ Object
readonly
Returns the value of attribute basename.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #==(another) ⇒ Object
- #eql?(another) ⇒ Boolean
- #escaped_name ⇒ Object
-
#initialize(hash) ⇒ Node
constructor
Takes a hash as input with following keys: :node, :parent, :dir, :name.
- #to_s ⇒ Object
- #to_str ⇒ Object
Methods included from Util
#del_prefix_class, #del_prefix_file, #del_spaces, #do_filter, #escape_all, #escape_class_name, #escape_const_ref_ptr, escape_const_ref_ptr, #escape_file_name, #escape_template, home_dir, #match, read_file, write_file
Constructor Details
#initialize(hash) ⇒ Node
Takes a hash as input with following keys: :node, :parent, :dir, :name
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nodes/node.rb', line 32 def initialize(hash) @dir = hash[:dir] @name = hash[:name] if hash[:node] # If a reference to an xml declaration (node) is given @node = hash[:node] @parent = hash[:parent] @name = find_name if @name =~ /PxVec3.h/ @name = find_name end @dir ||= @parent.dir unless @parent.nil? end raise "No name given for node: #{self.class.name}" unless @name raise "No xml directory given for node: #{self.class.name}" unless @dir init_attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object (private)
55 56 57 58 59 60 61 |
# File 'lib/nodes/node.rb', line 55 def method_missing(sym, *args) if @node.respond_to?(sym) @node.send(sym, *args) else @node[sym.to_s] || super end end |
Instance Attribute Details
#basename ⇒ Object (readonly)
Returns the value of attribute basename.
10 11 12 |
# File 'lib/nodes/node.rb', line 10 def basename @basename end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
8 9 10 |
# File 'lib/nodes/node.rb', line 8 def dir @dir end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
12 13 14 |
# File 'lib/nodes/node.rb', line 12 def doc @doc end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/nodes/node.rb', line 9 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
11 12 13 |
# File 'lib/nodes/node.rb', line 11 def node @node end |
#parent ⇒ Object
Returns the value of attribute parent.
13 14 15 |
# File 'lib/nodes/node.rb', line 13 def parent @parent end |
Instance Method Details
#==(another) ⇒ Object
15 16 17 |
# File 'lib/nodes/node.rb', line 15 def == another self.name == another.name end |
#eql?(another) ⇒ Boolean
19 20 21 |
# File 'lib/nodes/node.rb', line 19 def eql?(another) self.name == another.name end |
#escaped_name ⇒ Object
49 50 51 |
# File 'lib/nodes/node.rb', line 49 def escaped_name name end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/nodes/node.rb', line 27 def to_s @name end |
#to_str ⇒ Object
23 24 25 |
# File 'lib/nodes/node.rb', line 23 def to_str @name end |