uri
String
parses uri
and constructs either matching URI
scheme object (FTP
, HTTP
, HTTPS
, LDAP
, LDAPS
, or MailTo
) or URI::Generic
p = URI::Parser.new p.parse("ldap://ldap.example.com/dc=example?user=john") #=> #<URI::LDAP:0x00000000b9e7e8 URL:ldap://ldap.example.com/dc=example?user=john>
Starts the CGI
process with the given environment env
and standard input and output stdin
and stdout
.
Parses a Cookie
field sent from the user-agent. Returns an array of cookies.
Parses a request from socket
. This is called internally by WEBrick::HTTPServer
.
Converts version
into an HTTPVersion
A SimpleServer
only yields when you start it
Performs the standard operations for daemonizing a process. Runs a block, if given.
Starts the server and runs the block
for each connection. This method does not return until the server is stopped from a signal handler or another thread using stop
or shutdown
.
If the block raises a subclass of StandardError
the exception is logged and ignored. If an IOError
or Errno::EBADF exception is raised the exception is ignored. If an Exception
subclass is raised the exception is logged and re-raised which stops the server.
To completely shut down a server call shutdown
from ensure:
server = WEBrick::GenericServer.new # or WEBrick::HTTPServer.new begin server.start ensure server.shutdown end
Sets the Net::HTTP#read_timeout
and Net::HTTP#open_timeout
to new_timeout
You can use this method to execute several methods on a XMLRPC
server which support the multi-call extension.
s.multicall( ['michael.add', 3, 4], ['michael.sub', 4, 5] ) # => [7, -1]
Same as XMLRPC::Client#multicall
, but returns two parameters instead of raising an XMLRPC::FaultException
.
Returns the conversion path of ec.
The result is an array of conversions.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP", crlf_newline: true) p ec.convpath #=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>], # [#<Encoding:UTF-8>, #<Encoding:EUC-JP>], # "crlf_newline"]
Each element of the array is a pair of encodings or a string. A pair means an encoding conversion. A string means a decorator.
In the above example, [#<Encoding:ISO-8859-1>,
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
.
Creates a class to wrap the C union described by signature
.
MyUnion = union ['int i', 'char c']
Start streaming using encoding
Set
all the parameters.
Parses self
destructively and returns self
containing the rest arguments left unparsed.
Returns collection of supported maker versions
Executes the passed block and raises exception
if execution takes more than seconds
.
If seconds
is zero or nil, simply executes the block
Executes the passed block and raises exception
if execution takes more than seconds
.
If seconds
is zero or nil, simply executes the block
Converts a the given str
to a dateTime.iso8601
formatted date.
Raises an exception if the String isn’t in dateTime.iso8601
format.
See also, XMLRPC::DateTime
Tries to convert obj
into an array, using to_ary
method. Returns the converted array or nil
if obj
cannot be converted for any reason. This method can be used to check if an argument is an array.
Array.try_convert([1]) #=> [1] Array.try_convert("1") #=> nil if tmp = Array.try_convert(arg) # the argument is an array elsif tmp = String.try_convert(arg) # the argument is a string end