Returns the parser to be used.
Unless a URI::Parser
is defined, DEFAULT_PARSER is used.
Sets userinfo, argument is string like ‘name:pass’.
v
Public setter for the user
component (with validation).
See also URI::Generic.check_user
.
require 'uri' uri = URI.parse("http://john:S3nsit1ve@my.example.com") uri.user = "sam" uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com"
Returns the userinfo, either as ‘user’ or ‘user:password’.
Returns the user component.
v
Public setter for the query component v
.
require 'uri' uri = URI.parse("http://my.example.com/?id=25") uri.query = "id=1" uri.to_s #=> "http://my.example.com/?id=1"
Returns true if URI
is hierarchical.
URI
has components listed in order of decreasing significance from left to right, see RFC3986 tools.ietf.org/html/rfc3986 1.2.3.
require 'uri' uri = URI.parse("http://my.example.com/") uri.hierarchical? #=> true uri = URI.parse("mailto:joe@example.com") uri.hierarchical? #=> false
Attempts to parse other URI
oth
, returns [parsed_oth, self].
require 'uri' uri = URI.parse("http://my.example.com") uri.coerce("http://foo.com") #=> [#<URI::HTTP http://foo.com>, #<URI::HTTP http://my.example.com>]
Returns filter.
Setter for filter val
.
Setter for headers v
.
Services the request req
which will fill in the response res
. See WEBrick::HTTPServlet::AbstractServlet#service
for details.
Request query as a Hash
Services req
and fills in res
Converts version
into an HTTPVersion
Closes the logger (also closes the log device associated to the logger)
Shortcut for logging an ERROR
message
Will the logger output ERROR
messages?
Returns a Hash
(not a DBM
database) created by using each value in the database as a key, with the corresponding key as its value.
Note that all values in the hash will be Strings, but the keys will be actual objects.
Returns the number of the signal that caused stat to terminate (or nil
if self was not terminated by an uncaught signal).
Convert source_string and return destination_string.
source_string is assumed as a part of source. i.e. :partial_input=>true is specified internally. finish method should be used last.
ec = Encoding::Converter.new("utf-8", "euc-jp") puts ec.convert("\u3042").dump #=> "\xA4\xA2" puts ec.finish.dump #=> "" ec = Encoding::Converter.new("euc-jp", "utf-8") puts ec.convert("\xA4").dump #=> "" puts ec.convert("\xA2").dump #=> "\xE3\x81\x82" puts ec.finish.dump #=> "" ec = Encoding::Converter.new("utf-8", "iso-2022-jp") puts ec.convert("\xE3").dump #=> "".force_encoding("ISO-2022-JP") puts ec.convert("\x81").dump #=> "".force_encoding("ISO-2022-JP") puts ec.convert("\x82").dump #=> "\e$B$\"".force_encoding("ISO-2022-JP") puts ec.finish.dump #=> "\e(B".force_encoding("ISO-2022-JP")
If a conversion error occur, Encoding::UndefinedConversionError
or Encoding::InvalidByteSequenceError
is raised. Encoding::Converter#convert
doesn’t supply methods to recover or restart from these exceptions. When you want to handle these conversion errors, use Encoding::Converter#primitive_convert
.
If none is given, returns the resulting hash value of the digest, keeping the digest’s state.
If a string is given, returns the hash value for the given string, resetting the digest to the initial state before and after the process.
Returns the resulting hash value and resets the digest to the initial state.