Class: Backports::StdLib::LoadedFeatures

### Home Classes Methods

### In Files

- lib/backports/tools.rb

### Parent

Object

### Methods

- ::mark_as_loaded
- #include?

### Class/Module Index

Quicksearch

- Prime
- Prime::EratosthenesGenerator
- Prime::EratosthenesSieve
- Prime::Generator23
- Prime::OldCompatibility
- Prime::PseudoPrimeGenerator
- Prime::TrialDivision
- Prime::TrialDivisionGenerator
- Backports
- Backports::MOST_EXTREME_OBJECT_EVER
- Backports::StdLib
- Backports::StdLib::LoadedFeatures
- Enumerator
- Enumerator::GeneratorBP
- Enumerator::Lazy
- Enumerator::Yielder
- Matrix
- Matrix::EigenvalueDecomposition
- Matrix::LUPDecomposition
- Random
- Random::Implementation
- Random::MT19937
- Enumerable
- Enumerable::Enumerator
- File
- File::Constants
- ARGF
- Array
- BasicObject
- Binding
- Complex
- Dir
- ENV
- Fixnum
- Float
- GC
- Hash
- IO
- Integer
- Kernel
- Math
- Method
- Module
- NilClass
- Numeric
- Object
- ObjectSpace
- OpenStruct
- Proc
- Process
- Range
- Regexp
- Set
- StopIteration
- String
- Struct
- Symbol
- UnboundMethod

No matching classes.

# Backports::StdLib::LoadedFeatures

### Public Class Methods

mark_as_loaded(feature) click to toggle source

    # File lib/backports/tools.rb, line 44
    def self.mark_as_loaded(feature)
      @@our_loads[feature] = true
      # Nothing to do, the full path will be OK
    end

### Public Instance Methods

include?(feature) click to toggle source

Check loaded features for one that matches "#{any of the load path}/#{feature}"

    # File lib/backports/tools.rb, line 32
    def include?(feature)
      return true if @@our_loads[feature]
      # Assume backported features are Ruby libraries (i.e. not C)
      @loaded ||= $LOADED_FEATURES.group_by{|p| File.basename(p, ".rb")}
      if fullpaths = @loaded[File.basename(feature, ".rb")]
        fullpaths.any?{|fullpath|
          base_dir, = fullpath.partition("/#{feature}")
          $LOAD_PATH.include?(base_dir)
        }
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.