Sha256: 4ea90ef9e28580806570d14b5564f550437cd743d3a13c8cc592a807476281e9

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

module PrivatePlease::Tracking

  module LoadUtils
    require File.dirname(__FILE__) + '/load_utils/gem_utils'
    require File.dirname(__FILE__) + '/load_utils/standard_lib_utils'

    class << self

      def standard_lib_or_gem?(requiree)
        (@@_standard_lib_or_gem ||= {})[requiree] ||= begin
          standard_lib?(requiree) || gem?(requiree)
        end
      end

      def standard_lib?(requiree)
        (@@_standard_lib ||= {})[requiree] ||= StandardLibUtils.standard_lib?(requiree)
      end

      def gem?(requiree)
        (@@_gems ||= {})[requiree] ||= begin
          base_name = requiree.include?('/') ?
              requiree.split('/').first :      #  ex:   require 'rspec/autorun'
              requiree                         #  ex:   require 'rspec'
          GemUtils.gems_names.include?(base_name)
        end

      end

    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
private_please-0.0.5 lib/private_please/tracking/load_utils.rb