class Uncool::Analysis
Public Class Methods
new(trace, options={})
click to toggle source
# File lib/uncool/analysis.rb, line 10 def initialize(trace, options={}) @trace = trace @private = options[:private] end
Public Instance Methods
checklist()
click to toggle source
Returns a list of all possible coverage points.
# 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()
click to toggle source
Returns a list of postive and negative coverage.
# File lib/uncool/analysis.rb, line 33 def coverage covered | checklist end
covered()
click to toggle source
Return a list of units that were covered.
# 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()
click to toggle source
# File lib/uncool/analysis.rb, line 16 def log @trace.log end
private?()
click to toggle source
# File lib/uncool/analysis.rb, line 28 def private? @private end
targets()
click to toggle source
# File lib/uncool/analysis.rb, line 21 def targets @trace.targets.map do |t| eval(t, TOPLEVEL_BINDING) end end