Sha256: 9b1e8dce3055a43488c78ac51dcd991f1857ec541df378705fb11be727551f52

Contents?: true

Size: 868 Bytes

Versions: 6

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module DeepCover
  load_all

  module InstructionSequenceLoadIseq
    def load_iseq(path)
      compiled = InstructionSequenceLoadIseq.load_iseq_logic(path)

      return compiled if compiled

      # By default there is no super, but if bootsnap is there, and things are in the right order,
      # we could possibly fallback to it as usual to keep the perf gain. Same for other possible
      # tools using #load_iseq
      super if defined?(super)
    end

    def self.load_iseq_logic(path)
      return unless DeepCover.running?
      return unless DeepCover.within_lookup_paths?(path)

      covered_code = DeepCover.coverage.covered_code_or_warn(path)
      return unless covered_code

      covered_code.compile_or_warn
    end
  end
end

class << RubyVM::InstructionSequence
  prepend DeepCover::InstructionSequenceLoadIseq
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
deep-cover-core-0.6.4 lib/deep_cover/core_ext/instruction_sequence_load_iseq.rb
deep-cover-core-0.6.3 lib/deep_cover/core_ext/instruction_sequence_load_iseq.rb
deep-cover-core-0.6.3.pre lib/deep_cover/core_ext/instruction_sequence_load_iseq.rb
deep-cover-0.6.2 lib/deep_cover/core_ext/instruction_sequence_load_iseq.rb
deep-cover-0.6.1 lib/deep_cover/core_ext/instruction_sequence_load_iseq.rb
deep-cover-0.6.0 lib/deep_cover/core_ext/instruction_sequence_load_iseq.rb