Class: Emma::Report::Node
- Inherits:
-
Object
- Object
- Emma::Report::Node
- Defined in:
- lib/emma/report.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #classes ⇒ Object
- #coverages ⇒ Object
-
#initialize(element) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
- #methods ⇒ Object
- #name ⇒ Object
- #packages ⇒ Object
- #source_files ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(element) ⇒ Node
Returns a new instance of Node.
45 46 47 |
# File 'lib/emma/report.rb', line 45 def initialize(element) @element = element end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
43 44 45 |
# File 'lib/emma/report.rb', line 43 def parent @parent end |
Instance Method Details
#classes ⇒ Object
61 62 63 |
# File 'lib/emma/report.rb', line 61 def classes nodes_from @element.xpath(".//class") end |
#coverages ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/emma/report.rb', line 83 def coverages @coverages ||= Coverages.new( coverage_value_for('class'), coverage_value_for('method'), coverage_value_for('block'), coverage_value_for('line') ) end |
#inspect ⇒ Object
49 50 51 |
# File 'lib/emma/report.rb', line 49 def inspect '#<%s:0x%x %s>' % [self.class, hash, "type=#{type.inspect} name=#{name.inspect}"] end |
#methods ⇒ Object
69 70 71 |
# File 'lib/emma/report.rb', line 69 def methods nodes_from @element.xpath(".//method") end |
#name ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/emma/report.rb', line 73 def name name = @element['name'] parent = @element.parent if parent and not ['data', 'all'].include? parent.name name = [Node.new(parent).name, name].join ':' end name end |
#packages ⇒ Object
57 58 59 |
# File 'lib/emma/report.rb', line 57 def packages nodes_from @element.xpath(".//package") end |
#source_files ⇒ Object
65 66 67 |
# File 'lib/emma/report.rb', line 65 def source_files nodes_from @element.xpath(".//srcfile") end |
#type ⇒ Object
53 54 55 |
# File 'lib/emma/report.rb', line 53 def type @element.name.to_sym end |