Syntax (spacing)

This commit is contained in:
Scott Schneider 2013-10-01 15:44:11 -07:00
parent ba56310415
commit bdee20cf21
2 changed files with 17 additions and 13 deletions

View file

@ -2,15 +2,15 @@
# available to younger rubies. It trys hard to not re-require
# files.
unless Kernel.respond_to?( :require_relative )
unless Kernel.respond_to?(:require_relative)
module Kernel
def require_relative( path )
desired_path = File.expand_path( '../' + path.to_str, caller[0] )
def require_relative(path)
desired_path = File.expand_path('../'+path.to_str, caller[0])
shortest = desired_path
$:.each do |path|
path += '/'
if desired_path.index( path ) == 0
candidate = desired_path.sub( path, '' )
if desired_path.index(path) == 0
candidate = desired_path.sub(path, '')
shortest = candidate if candidate.size < shortest.size
end
end