lib/polyglot.rb in polyglot-0.2.5 vs lib/polyglot.rb in polyglot-0.2.6

- old
+ new

@@ -1,6 +1,7 @@ $:.unshift File.dirname(__FILE__) +require 'pathname' module Polyglot @registrations ||= {} # Guard against reloading @loaded ||= {} @@ -11,10 +12,10 @@ } end def self.find(file, *options, &block) extensions = @registrations.keys*"," - is_absolute = file[0] == File::SEPARATOR || file[0] == File::ALT_SEPARATOR || file =~ /\A[A-Z]:\\/i + is_absolute = Pathname.new(file).absolute? (is_absolute ? [""] : $:).each{|lib| base = is_absolute ? "" : lib+File::SEPARATOR # In Windows, repeated SEPARATOR chars have a special meaning, avoid adding them matches = Dir[base+file+".{"+extensions+"}"] # Revisit: Should we do more do if more than one candidate found?