1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

lib/uri/file.rb: improve docs for URI::File

* lib/uri/file.rb: [DOC] fix invalid example code for URI::File.build
  to make it syntax highlighted; drop unnecessary `puts';
  fix unintended description list; fix typos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
stomar 2018-04-17 19:46:25 +00:00
parent 8cd5ccdc7f
commit c38cb43652

View file

@ -5,14 +5,14 @@ require 'uri/generic'
module URI module URI
# #
# The "file" URI is defined by RFC8089 # The "file" URI is defined by RFC8089.
# #
class File < Generic class File < Generic
# A Default port of nil for URI::File # A Default port of nil for URI::File.
DEFAULT_PORT = nil DEFAULT_PORT = nil
# #
# An Array of the available components for URI::File # An Array of the available components for URI::File.
# #
COMPONENT = [ COMPONENT = [
:scheme, :scheme,
@ -30,20 +30,22 @@ module URI
# The components should be provided either as an Array, or as a Hash # The components should be provided either as an Array, or as a Hash
# with keys formed by preceding the component names with a colon. # with keys formed by preceding the component names with a colon.
# #
# If an Array is used, the components must be passed in the order # If an Array is used, the components must be passed in the
# [host, path] # order <code>[host, path]</code>.
# #
# If the path supplied is absolute, it will be escaped in order to # If the path supplied is absolute, it will be escaped in order to
# make it absolute in the URI. Examples: # make it absolute in the URI.
#
# Examples:
# #
# require 'uri' # require 'uri'
# #
# uri = URI::File.build(['host.example.com', '/path/file.zip']) # uri1 = URI::File.build(['host.example.com', '/path/file.zip'])
# puts uri.to_s -> file://host.example.com/path/file.zip # uri1.to_s # => "file://host.example.com/path/file.zip"
# #
# uri2 = URI::File.build({:host => 'host.example.com', # uri2 = URI::File.build({:host => 'host.example.com',
# :path => 'ruby/src'}) # :path => 'ruby/src'})
# puts uri2.to_s -> file://host.example.com/ruby/src # uri2.to_s # => "file://host.example.com/ruby/src"
# #
def self.build(args) def self.build(args)
tmp = Util::make_components_hash(self, args) tmp = Util::make_components_hash(self, args)