Sha256: 045ace7e86303b18dc554b7c75212978b4b51cfe049791b16441c4f3fa4b1906

Contents?: true

Size: 1.08 KB

Versions: 129

Compression:

Stored size: 1.08 KB

Contents

# Rcov::CoverageInfo is but a wrapper for an array, with some additional
# checks. It is returned by FileStatistics#coverage.
class CoverageInfo
  def initialize(coverage_array)
    @cover = coverage_array.clone
  end

  # Return the coverage status for the requested line. There are four possible
  # return values:
  # * nil if there's no information for the requested line (i.e. it doesn't exist)
  # * true if the line was reported by Ruby as executed
  # * :inferred if rcov inferred it was executed, despite not being reported 
  #   by Ruby.
  # * false otherwise, i.e. if it was not reported by Ruby and rcov's
  #   heuristics indicated that it was not executed
  def [](line)
    @cover[line]
  end

  def []=(line, val) # :nodoc:
    unless [true, false, :inferred].include? val
      raise RuntimeError, "What does #{val} mean?" 
    end
    return if line < 0 || line >= @cover.size
    @cover[line] = val
  end

  # Return an Array holding the code coverage information.
  def to_a
    @cover.clone
  end

  def method_missing(meth, *a, &b) # :nodoc:
    @cover.send(meth, *a, &b)
  end
end

Version data entries

129 entries across 61 versions & 9 rubygems

Version Path
dirty_history-0.5.2 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.11/lib/rcov/coverage_info.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/rcov-0.9.11/lib/rcov/coverage_info.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.11/lib/rcov/coverage_info.rb
dirty_history-0.5.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.5.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.11/lib/rcov/coverage_info.rb
dirty_history-0.5.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.5.0 dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.5.0 dirty_history/ruby/1.9.1/gems/rcov-0.9.11/lib/rcov/coverage_info.rb
chida_fib-0.1.0 shoulda/ruby/1.8/gems/rcov-1.0.0/lib/rcov/coverage_info.rb
rcov-1.0.0 lib/rcov/coverage_info.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/rcov-0.9.11/lib/rcov/coverage_info.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.11/lib/rcov/coverage_info.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.4.9 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb
dirty_history-0.4.9 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rcov-0.9.9/lib/rcov/coverage_info.rb