Class: Uncool::Analysis
- Inherits:
-
Object
- Object
- Uncool::Analysis
- Defined in:
- lib/uncool/analysis.rb
Instance Method Summary collapse
-
#checklist ⇒ Object
Returns a list of all possible coverage points.
-
#coverage ⇒ Object
Returns a list of postive and negative coverage.
-
#covered ⇒ Object
Return a list of units that were covered.
-
#initialize(trace, options = {}) ⇒ Analysis
constructor
A new instance of Analysis.
- #log ⇒ Object
- #private? ⇒ Boolean
- #targets ⇒ Object
Constructor Details
#initialize(trace, options = {}) ⇒ Analysis
Returns a new instance of Analysis.
10 11 12 13 |
# File 'lib/uncool/analysis.rb', line 10 def initialize(trace, ={}) @trace = trace @private = [:private] end |
Instance Method Details
#checklist ⇒ Object
Returns a list of all possible coverage points.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/uncool/analysis.rb', line 50 def checklist coverage = [] targets.each do |target| target.instance_methods(false).each do |meth| unit = Unit.new(target, meth) coverage << unit end target.methods(false).each do |meth| unit = Unit.new(target, meth, :function=>true) coverage << unit end if private? target.protected_instance_methods(false).each do |meth| unit = Unit.new(target, meth, :access=>:protected) coverage << unit end target.private_instance_methods(false).each do |meth| unit = Unit.new(target, meth, :access=>:private) coverage << unit end target.protected_methods(false).each do |meth| unit = Unit.new(target, meth, :access=>:protected, :function=>true) coverage << unit end target.private_methods(false).each do |meth| unit = Unit.new(target, meth, :access=>:private, :function=>true) coverage << unit end end end coverage end |
#coverage ⇒ Object
Returns a list of postive and negative coverage.
33 34 35 |
# File 'lib/uncool/analysis.rb', line 33 def coverage covered | checklist end |
#covered ⇒ Object
Return a list of units that were covered.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/uncool/analysis.rb', line 38 def covered @coverage ||= ( list = [] log.each do |object, method| unit = Unit.new(object.class, method, :covered=>true) list << unit end list ) end |
#log ⇒ Object
16 17 18 |
# File 'lib/uncool/analysis.rb', line 16 def log @trace.log end |
#private? ⇒ Boolean
28 29 30 |
# File 'lib/uncool/analysis.rb', line 28 def private? @private end |
#targets ⇒ Object
21 22 23 24 25 |
# File 'lib/uncool/analysis.rb', line 21 def targets @trace.targets.map do |t| eval(t, TOPLEVEL_BINDING) end end |