Sha256: 7338f2995f72a6e19ec43dbf6c8fec12d2d4b9636d958cc4f8f7752db5d1786b

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 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.expand_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

class String
  def ~@
    File.expand_path(File.join(__DIR__(caller.first), self))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dirge-0.0.2 lib/dirge.rb