module Kernel

Public Instance Methods

require_relative(relative_path) click to toggle source
# File lib/wordpress-client.rb, line 3
def require_relative(relative_path)
  desired_path = File.expand_path('../' + relative_path.to_str, caller[0])
  shortest = desired_path
  $:.each do |path|
    path += '/'
    if desired_path.index(path) == 0
      candidate = desired_path.sub(path, '')
      shortest = candidate if candidate.size < shortest.size
    end
  end
  require shortest
end