try_convert

Hash.try_convert(obj) â hash or nil Class Public methods Try to convert obj into a hash, using #to_hash method. Returns converted hash or nil if obj cannot be converted for any reason. Hash.try_convert({1=>2}) # => {1=>2} Hash.try_convert("1=>2") # => nil

new

Hash.new â new_hashHash.new(obj) â new_hashHash.new {|hash, key| block } â new_hash Class Public methods Returns a new, empty hash. If this hash is subsequently accessed by a key that doesn't correspond to a hash entry, the value returned depends on the style of new used to create the hash. In the first form, the access returns nil. If obj is specified, this single object will be used for all default values. If a block is specified,

[]

Hash[ key, value, ... ] â new_hashHash[ [ [key, value], ... ] ] â new_hashHash[ object ] â new_hash Class Public methods Creates a new hash populated with the given objects. Equivalent to the literal { key => value, ... }. In the first form, keys and values occur in pairs, so there must be an even number of arguments. The second and third form take a single argument which is either an array of key-value pairs or an object convertible to a hash. Hash["

stopping

stopping() Instance Protected methods Called when the server is shutting down, if auditing is enabled.

starting

starting() Instance Protected methods Called when the server is starting up, if auditing is enabled.

log

log(msg) Instance Protected methods Log a message to stdlog, if it's defined. This implementation outputs the timestamp and message to the log. msg the message to log

error

error(detail) Instance Protected methods Called if debug is true whenever an unhandled exception is raised. This implementation simply logs the backtrace. detail the Exception that was caught

disconnecting

disconnecting(clientPort) Instance Protected methods Called when a client disconnects, if audition is enabled. clientPort the port of the client that is connecting

connecting

connecting(client) Instance Protected methods Called when a client connects, if auditing is enabled. client a TCPSocket instance representing the client that connected Return true to allow this client to connect, false to prevent it.

stopped?

stopped?() Instance Public methods Returns true if the server has stopped.