Sha256: ab9fa0627d548c110c8360beed961bb606a058291de2de790ff70d611a336f3d

Contents?: true

Size: 426 Bytes

Versions: 7

Compression:

Stored size: 426 Bytes

Contents

module Kernel
  def __DIR_REL__(called_from = nil)
    parsed_line = Callsite.parse(called_from || caller.first)
    parsed_line && File.expand_path(File.dirname(parsed_line.filename))
  end

  unless method_defined?(:__DIR__)
    alias_method :__DIR__, :__DIR_REL__
  end

  unless method_defined?(:require_relative)
    def require_relative(path)
      require File.join(__DIR_REL__(caller.first), path)
    end
  end
end
  

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
callsite-0.0.11 lib/loaders/kernel_dir.rb
callsite-0.0.6 lib/loaders/kernel_dir.rb
callsite-0.0.5 lib/loaders/kernel_dir.rb
callsite-0.0.4 lib/loaders/kernel_dir.rb
callsite-0.0.3 lib/loaders/kernel_dir.rb
callsite-0.0.2 lib/loaders/kernel_dir.rb
callsite-0.0.1 lib/loaders/kernel_dir.rb