lib/eymiha/url/url_normalizer.rb in eymiha_url-1.0.1 vs lib/eymiha/url/url_normalizer.rb in eymiha_url-1.0.2

- old
+ new

@@ -81,19 +81,26 @@ end # Returns true if the given URL file resource is absolute. def self.absolute_file_path? file_url @@using_pc_filesystem ? - (file_url =~ /^[A-Za-z]:\//) : + ((file_url =~ /^[A-Za-z]:\//) or (file_url =~ /^\//)) : (!(file_url =~ /^[A-Za-z]:/) and (file_url =~ /^\//)) end + + # grafts on the drive designator for an absolute file if not present and + # on a pc filesystem + def self.absolute_file_path file_url + (@@using_pc_filesystem && (file_url =~ /^\//)) ? + "C:#{file_url}" : file_url + end # Returns an absolute path for the given URL file resource. This is either # the incoming URL if absolute, or the URL anchored at the relative base # if relative. def normalize_file_path file_url if self.class.absolute_file_path? file_url - file_url + self.class.absolute_file_path file_url elsif @relative_base != nil "#{relative_base}#{file_url}" else raise UrlException, "no relative file base was configured" end