This method is a shortcut for converting a single row (Array) into a CSV
String.
The options
parameter can be anything CSV::new()
understands. This method understands an additional :encoding
parameter to set the base Encoding
for the output. This method will try to guess your Encoding
from the first non-nil
field in row
, if possible, but you may need to use this parameter as a backup plan.
The :row_sep
option
defaults to $INPUT_RECORD_SEPARATOR
($/
) when calling this method.
Identical to CSV#convert()
, but for header rows.
Note that this method must be called before header rows are read to have any effect.
Loads any converters requested during construction.
If field_name
is set :converters
(the default) field converters are set. When field_name
is :header_converters
header converters are added instead.
The :unconverted_fields
option is also activated for :converters
calls, if requested.
The actual work method for adding converters, used by both CSV.convert()
and CSV.header_convert()
.
This method requires the var_name
of the instance variable to place the converters in, the const
Hash
to lookup named converters in, and the normal parameters of the CSV.convert()
and CSV.header_convert()
methods.
Return the appropriate error message in POSIX-defined format. If no error has occurred, returns nil.
Returns true
if this is a lower triangular matrix.
Returns true if the set is a proper superset of the given set.
Returns the current execution stack—an array containing backtrace location objects.
See Thread::Backtrace::Location
for more information.
The optional start parameter determines the number of initial stack entries to omit from the top of the stack.
A second optional length
parameter can be used to limit how many entries are returned from the stack.
Returns nil
if start is greater than the size of current execution stack.
Optionally you can pass a range, which will return an array containing the entries within the specified range.
Generate a JSON
document from the Ruby data structure obj and return it. This method disables the checks for circles in Ruby objects.
WARNING: Be careful not to pass any Ruby data structures with circles as obj argument because this will cause JSON
to go into an infinite loop.
Generate a JSON
document from the Ruby data structure obj and return it. The returned document is a prettier form of the document returned by unparse.
The opts argument can be used to configure the generator. See the generate method for a more detailed explanation.
Returns the number of malloc() allocations.
Only available if ruby was built with CALC_EXACT_MALLOC_SIZE
.
Get the ‘current’ server.
In the context of execution taking place within the main thread of a dRuby server (typically, as a result of a remote call on the server or one of its objects), the current server is that server. Otherwise, the current server is the primary server.
If the above rule fails to find a server, a DRbServerNotFound
error is raised.
Get the ‘current’ server.
In the context of execution taking place within the main thread of a dRuby server (typically, as a result of a remote call on the server or one of its objects), the current server is that server. Otherwise, the current server is the primary server.
If the above rule fails to find a server, a DRbServerNotFound
error is raised.
Registers server
with DRb
.
This is called when a new DRb::DRbServer is created.
If there is no primary server then server
becomes the primary server.
Example:
require 'drb' s = DRb::DRbServer.new # automatically calls regist_server DRb.fetch_server s.uri #=> #<DRb::DRbServer:0x...>
Registers server
with DRb
.
This is called when a new DRb::DRbServer is created.
If there is no primary server then server
becomes the primary server.
Example:
require 'drb' s = DRb::DRbServer.new # automatically calls regist_server DRb.fetch_server s.uri #=> #<DRb::DRbServer:0x...>
Removes server
from the list of registered servers.
Removes server
from the list of registered servers.
Retrieves the server with the given uri
.
See also regist_server
and remove_server.
Add observer
as an observer on this object. so that it will receive notifications.
observer
the object that will be notified of changes.
func
Symbol
naming the method that will be called when this Observable
has changes.
This method must return true for observer.respond_to?
and will receive *arg
when notify_observers
is called, where *arg
is the value passed to notify_observers
by this Observable
Remove observer
as an observer on this object so that it will no longer receive notifications.
observer
An observer of this Observable
Remove all observers associated with this object.
Return the number of observers associated with this object.
Notify observers of a change in state if this object’s changed state is true
.
This will invoke the method named in add_observer
, passing *arg
. The changed state is then set to false
.
*arg
Any arguments to pass to the observers.