Sha256: 5af44e960d9da19cff7f269e9c891e98b3ffdbfb349dad424258106e02a6c3b1

Contents?: true

Size: 430 Bytes

Versions: 1

Compression:

Stored size: 430 Bytes

Contents

module Kernel
  def __DIR__(called_from = nil)
    called_from ||= caller.first
    caller_path = called_from[/(.*?(?=:\d))/, 1]
    caller_path = '.' if caller_path == ''
    File.dirname(caller_path)
  end

  def require_relative(path)
    require File.join(__DIR__(caller.first), path)
  end

end

class Module
  def self.autoload_relative(name, filename)
    autoload name, File.join(__DIR__(caller.first), filename)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dirge-0.0.1 lib/dirge.rb