Class: WarningShot::CoreLibResolver Private

Inherits:
Object
  • Object
show all
Includes:
Resolver
Defined in:
lib/resolvers/core_lib_resolver.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Check to see if core lib packages are available

Created due to issues with some Apt installs not installing all
ruby core classes.  This is irresolvable, but at least gives you
a heads up.

Defined Under Namespace

Classes: CoreLibResource

Constant Summary collapse

@@do_purge =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

false
@@original_requires =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

$".clone
@@original_classes =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

Symbol.all_symbols.clone

Class Method Summary collapse

Methods included from Resolver

descendants

Class Method Details

.purge(do_purge = false) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

optionally purge CoreLIb classes in memory The default behavior is to just remove the reference to loading the class from $“. Classes stay in memory but can be re-required without returning false

Parameters:

  • do_purge (Boolean) (defaults to: false)

    (Default: false) Should classes be purged from memory.



28
29
30
# File 'lib/resolvers/core_lib_resolver.rb', line 28

def self.purge(do_purge=false)
  @@do_purge = do_purge
end

.purge_classes(classes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Undefines classes

Parameters:

  • classes (Array(Symbol))

    classes to remove



68
69
70
71
72
# File 'lib/resolvers/core_lib_resolver.rb', line 68

def purge_classes(classes)
  classes.each do |klass|
    Object.send(:remove_const, klass) if Object.is_const_defined? klass
  end
end

.unload(files) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

removes files from $“ so they can be re-required

Parameters:

  • files (Array(String))

    files to remove



56
57
58
59
60
# File 'lib/resolvers/core_lib_resolver.rb', line 56

def unload(files)
  files.each do |req|
    $".delete(req)
  end
end