Sha256: a96369c864d9a6b5b036a3a305fee54a445d969370a786b68b9af7895a978deb

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

module Oj
  
  def self.mimic_loaded(mimic_paths=[])
    gems_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
    Dir.foreach(gems_dir) do |gem|
      next unless (gem.start_with?('json') || gem.start_with?('json_pure'))
      $LOADED_FEATURES << File.join(gems_dir, gem, 'lib', 'json.rb')
    end
    # and another approach in case the first did not get all
    $LOAD_PATH.each do |d|
      next unless File.exist?(d)
      Dir.foreach(d) do |file|
        next unless file.end_with?('json.rb')
        $LOADED_FEATURES << File.join(d, file) unless $LOADED_FEATURES.include?(file)
      end
    end
    mimic_paths.each { |p| $LOADED_FEATURES << p }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oj-2.0.12 lib/oj/mimic.rb