Results for: "OptionParser"

The content-length header

The content-type header

The content-length header

Sets the content-length header to len

The content-type header

Sets the content-type header to type

Redirects to url with a WEBrick::HTTPStatus::Redirect status.

Example:

res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect
No documentation available

Similar to XMLRPC::Client#multicall, however can be called concurrently and use a new connection for each request. In contrast to the corresponding method without the _async suffix, which use connect-alive (one connection for all requests).

Note, that you have to use Thread to call these methods concurrently. The following example calls two methods concurrently:

Thread.new {
  p client.multicall_async("michael.add", 4, 5)
}

Thread.new {
  p client.multicall_async("michael.div", 7, 9)
}

Same as XMLRPC::Client#multicall2, but can be called concurrently.

See also XMLRPC::Client#multicall_async

No documentation available
No documentation available
No documentation available

Return a Time object of the date/time which represents self. If the @year is below 1970, this method returns nil, because Time cannot handle years below 1970.

The timezone used is GMT.

Adds aBlock to the list of handlers, with name as the name of the method.

Parameters signature and help are used by the Introspection method if specified, where signature is either an Array containing strings each representing a type of it’s signature (the first is the return value) or an Array of Arrays if the method has multiple signatures.

Value type-names are “int, boolean, double, string, dateTime.iso8601, base64, array, struct”.

Parameter help is a String with information about how to call this method etc.

When a method fails, it can tell the client by throwing an XMLRPC::FaultException like in this example:

s.add_handler("michael.div") do |a,b|
  if b == 0
    raise XMLRPC::FaultException.new(1, "division by zero")
  else
    a / b
  end
end

In the case of b==0 the client gets an object back of type XMLRPC::FaultException that has a faultCode and faultString field.

This is the second form of ((<add_handler|XMLRPC::BasicServer#add_handler>)). To add an object write:

server.add_handler("michael", MyHandlerClass.new)

All public methods of MyHandlerClass are accessible to the XML-RPC clients by michael."name of method". This is where the class_delim in XMLRPC::BasicServer.new plays it’s role, a XML-RPC method-name is defined by prefix + class_delim + "name of method".

The third form of +add_handler is to use XMLRPC::Service::Interface to generate an object, which represents an interface (with signature and help text) for a handler class.

The interface parameter must be an instance of XMLRPC::Service::Interface. Adds all methods of obj which are defined in the interface to the server.

This is the recommended way of adding services to a server!

Adds the multi-call handler "system.multicall".

No documentation available

Returns true, if the arity of obj matches n_args

No documentation available
No documentation available

Calls the given block once for each key, value pair in the database.

Returns self.

Returns the number of threads waiting on the queue.

Returns the number of threads waiting on the queue.

Returns the discarded bytes when Encoding::InvalidByteSequenceError occurs.

ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
begin
  ec.convert("abc\xA1\xFFdef")
rescue Encoding::InvalidByteSequenceError
  p $!      #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
  puts $!.error_bytes.dump          #=> "\xA1"
  puts $!.readagain_bytes.dump      #=> "\xFF"
end

Returns true if the invalid byte sequence error is caused by premature end of string.

ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")

begin
  ec.convert("abc\xA1z")
rescue Encoding::InvalidByteSequenceError
  p $!      #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP>
  p $!.incomplete_input?    #=> false
end

begin
  ec.convert("abc\xA1")
  ec.finish
rescue Encoding::InvalidByteSequenceError
  p $!      #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
  p $!.incomplete_input?    #=> true
end
Search took: 7ms  ·  Total Results: 4164