Sha256: 58573a1941c591b2d951c11921b12a9201061156c1d9abbe686458deaa967f71

Contents?: true

Size: 968 Bytes

Versions: 3

Compression:

Stored size: 968 Bytes

Contents

# Code coverage analysis.
#--
# Copyright 2006 Suraj N. Kurapati
# See the file named LICENSE for details.

require 'rcov'

# satisfy dependencies of 'rcov/report'
  require 'xx'

  module XX # :nodoc: all
    module XMLish
      include Markup

      def xmlish_ *a, &b
        xx_which(XMLish) { xx_with_doc_in_effect(*a, &b) }
      end
    end
  end

require 'rcov/report'


module RubyVPI
  module Coverage #:nodoc:
    @@analyzer = Rcov::CodeCoverageAnalyzer.new

    def Coverage.start
      @@analyzer.install_hook
    end

    def Coverage.stop
      @@analyzer.remove_hook
    end


    @@handlers = []

    # Invokes the given block after code coverage analysis has completed.
    def Coverage.attach &aBlock # :yield: Rcov::CodeCoverageAnalyzer
      raise ArgumentError unless block_given?
      @@handlers << aBlock if aBlock
    end

    at_exit do
      Coverage.stop

      @@handlers.each do |h|
        h.call @@analyzer
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-vpi-20.0.0 lib/ruby-vpi/rcov.rb
ruby-vpi-21.1.0 lib/ruby-vpi/rcov.rb
ruby-vpi-21.0.0 lib/ruby-vpi/rcov.rb