Open a group database at path
Open a password database at path
Initializes a new servlet for server
using options
which are stored as-is in +@options+. +@logger+ is also provided.
Creates a new CGI
script servlet for the script at name
Creates a new ERBHandler
on server
that will evaluate and serve the ERB
file name
Creates a DefaultFileHandler
instance for the file at local_path
.
Creates a FileHandler
servlet on server
that serves files starting at directory root
options
may be a Hash
containing keys from WEBrick::Config::FileHandler or true
or false
.
If options
is true or false then :FancyIndexing
is enabled or disabled respectively.
Creates a new FormData
object.
args
is an Array of form data entries. One FormData
will be created for each entry.
This is called by WEBrick::HTTPUtils.parse_form_data
for you
Creates a new TimeoutHandler
. You should use ::register
and ::cancel
instead of creating the timeout handler directly.
Create a new streaming emitter. Emitter
will print to io
. See Psych::Stream
for an example.
The most standard error types are subclasses of StandardError
. A rescue clause without an explicit Exception
class will rescue all StandardErrors (and only those).
def foo raise "Oups" end foo rescue "Hello" #=> "Hello"
On the other hand:
require 'does/not/exist' rescue "Hi"
raises the exception:
LoadError: no such file to load -- does/not/exist
Raised when the arguments are wrong and there isn’t a more specific Exception
class.
Ex: passing the wrong number of arguments
[1, 2, 3].first(4, 5)
raises the exception:
ArgumentError: wrong number of arguments (given 2, expected 1)
Ex: passing an argument that is not acceptable:
[1, 2, 3].first(-4)
raises the exception:
ArgumentError: negative array size
Raised when a given numerical value is out of range.
[1, 2, 3].drop(1 << 100)
raises the exception:
RangeError: bignum too big to convert into `long'
Raised when there is an attempt to modify a frozen object.
[1, 2, 3].freeze << 4
raises the exception:
FrozenError: can't modify frozen Array
Raised when attempting to divide an integer by 0.
42 / 0 #=> ZeroDivisionError: divided by 0
Note that only division by an exact 0 will raise the exception:
42 / 0.0 #=> Float::INFINITY 42 / -0.0 #=> -Float::INFINITY 0 / 0.0 #=> NaN
Raised when attempting to convert special float values (in particular Infinity
or NaN
) to numerical classes which don’t support them.
Float::INFINITY.to_r #=> FloatDomainError: Infinity
The Comparable
mixin is used by classes whose objects may be ordered. The class must define the <=>
operator, which compares the receiver against another object, returning -1, 0, or +1 depending on whether the receiver is less than, equal to, or greater than the other object. If the other object is not comparable then the <=>
operator should return nil. Comparable
uses <=>
to implement the conventional comparison operators (<
, <=
, ==
, >=
, and >
) and the method between?
.
class SizeMatters include Comparable attr :str def <=>(other) str.size <=> other.str.size end def initialize(str) @str = str end def inspect @str end end s1 = SizeMatters.new("Z") s2 = SizeMatters.new("YY") s3 = SizeMatters.new("XXX") s4 = SizeMatters.new("WWWW") s5 = SizeMatters.new("VVVVV") s1 < s2 #=> true s4.between?(s1, s3) #=> false s4.between?(s3, s5) #=> true [ s3, s2, s5, s4, s1 ].sort #=> [Z, YY, XXX, WWWW, VVVVV]
An Array wrapper that can be sent to another server via DRb
.
All entries in the array will be dumped or be references that point to the local server.
WIN32OLE_PARAM
objects represent param information of the OLE method.
This exception is raised if a generator or unparser error occurs.
Raised by Encoding
and String methods when a transcoding operation fails.