Module: Ruar::Access::CoreExt

Defined in:
lib/ruar/core_ext/kernel_require.rb

Class Method Summary collapse

Class Method Details

.make_load_error(path) ⇒ Object



6
7
8
9
10
# File 'lib/ruar/core_ext/kernel_require.rb', line 6

def self.make_load_error(path)
  err = LoadError.new(+"cannot load such file -- #{path}")
  err.define_singleton_method(:path) { path }
  err
end

.pseudo_lf_entry(path) ⇒ Object

Generate pseudo $LOADED_FEATURES entry



13
14
15
16
17
18
19
20
21
# File 'lib/ruar/core_ext/kernel_require.rb', line 13

def self.pseudo_lf_entry(path)
  prefix = Ruar.path_prefix
  # TODO: support .so here
  if File.extname(path) == '.rb'
    Pathname.new(File.join(prefix, path)).cleanpath.to_s
  else
    Pathname.new(File.join(prefix, "#{path}.rb")).cleanpath.to_s
  end
end