diff options
Diffstat (limited to 'lib/uri/file.rb')
| -rw-r--r-- | lib/uri/file.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/uri/file.rb b/lib/uri/file.rb index 561ec703c4..47b5aef067 100644 --- a/lib/uri/file.rb +++ b/lib/uri/file.rb @@ -33,6 +33,9 @@ module URI # If an Array is used, the components must be passed in the # order <code>[host, path]</code>. # + # A path from e.g. the File class should be escaped before + # being passed. + # # Examples: # # require 'uri' @@ -44,6 +47,9 @@ module URI # :path => '/ruby/src'}) # uri2.to_s # => "file://host.example.com/ruby/src" # + # uri3 = URI::File.build({:path => URI::RFC2396_PARSER.escape('/path/my file.txt')}) + # uri3.to_s # => "file:///path/my%20file.txt" + # def self.build(args) tmp = Util::make_components_hash(self, args) super(tmp) @@ -64,17 +70,17 @@ module URI # raise InvalidURIError def check_userinfo(user) - raise URI::InvalidURIError, "can not set userinfo for file URI" + raise URI::InvalidURIError, "cannot set userinfo for file URI" end # raise InvalidURIError def check_user(user) - raise URI::InvalidURIError, "can not set user for file URI" + raise URI::InvalidURIError, "cannot set user for file URI" end # raise InvalidURIError def check_password(user) - raise URI::InvalidURIError, "can not set password for file URI" + raise URI::InvalidURIError, "cannot set password for file URI" end # do nothing @@ -90,5 +96,5 @@ module URI end end - @@schemes['FILE'] = File + register_scheme 'FILE', File end |
