Returns a Hash
containing implementation-dependent counters inside the VM.
This hash includes information about method/constant cache serials:
{ :global_method_state=>251, :global_constant_state=>481, :class_serial=>9029 }
The contents of the hash are implementation specific and may be changed in the future.
This method is only expected to work on C Ruby.
Synonym for $stdin.
Synonym for $stdout.
This method will return a CSV
instance, just like CSV::new()
, but the instance will be cached and returned for all future calls to this method for the same data
object (tested by Object#object_id()
) with the same options
.
If a block is given, the instance is passed to the block and the return value becomes the return value of the block.
Use to slurp a CSV
file into an Array of Arrays. Pass the path
to the file and any options
CSV::new()
understands. This method also understands an additional :encoding
parameter that you can use to specify the Encoding
of the data in the file to be read. You must provide this unless your data is in Encoding::default_external()
. CSV
will use this to determine how to parse the data. You may provide a second Encoding
to have the data transcoded as it is read. For example, encoding: "UTF-32BE:UTF-8"
would read UTF-32BE data from the file but transcode it to UTF-8 before CSV
parses it.
Alias for CSV::read()
.
Rewinds the underlying IO
object and resets CSV’s lineno() counter.
Slurps the remaining rows and returns an Array of Arrays.
The data source must be open for reading.
Returns the IO
used as stdout. Defaults to STDOUT
Sets the IO
used as stdout. Defaults to STDOUT
This method must be overridden by subclasses and should return the object method calls are being delegated to.
This method must be overridden by subclasses and change the object delegate to obj.
Trust both the object returned by _getobj_ and self.
Untrust both the object returned by _getobj_ and self.
Freeze both the object returned by _getobj_ and self.
Returns the current object method calls are being delegated to.
Changes the delegate object to obj.
It’s important to note that this does not cause SimpleDelegator’s methods to change. Because of this, you probably only want to change delegation to objects of the same type as the original delegate.
Here’s an example of changing the delegation object.
names = SimpleDelegator.new(%w{James Edward Gray II}) puts names[1] # => Edward names.__setobj__(%w{Gavin Sinclair}) puts names[1] # => Sinclair
Executes the generated ERB
code to produce a completed template, returning the results of that code. (See ERB::new
for details on how this process can be affected by safe_level.)
b accepts a Binding
object which is used to set the context of code evaluation.
Set
the handling of the ordering of options and arguments. A RuntimeError
is raised if option processing has already started.
The supplied value must be a member of GetoptLong::ORDERINGS
. It alters the processing of options as follows:
REQUIRE_ORDER :
Options are required to occur before non-options.
Processing of options ends as soon as a word is encountered that has not been preceded by an appropriate option flag.
For example, if -a and -b are options which do not take arguments, parsing command line arguments of ‘-a one -b two’ would result in ‘one’, ‘-b’, ‘two’ being left in ARGV, and only (‘-a’, ”) being processed as an option/arg pair.
This is the default ordering, if the environment variable POSIXLY_CORRECT is set. (This is for compatibility with GNU getopt_long.)
PERMUTE :
Options can occur anywhere in the command line parsed. This is the default behavior.
Every sequence of words which can be interpreted as an option (with or without argument) is treated as an option; non-option words are skipped.
For example, if -a does not require an argument and -b optionally takes an argument, parsing ‘-a one -b two three’ would result in (‘-a’,”) and (‘-b’, ‘two’) being processed as option/arg pairs, and ‘one’,‘three’ being left in ARGV.
If the ordering is set to PERMUTE but the environment variable POSIXLY_CORRECT is set, REQUIRE_ORDER is used instead. This is for compatibility with GNU getopt_long.
RETURN_IN_ORDER :
All words on the command line are processed as options. Words not preceded by a short or long option flag are passed as arguments with an option of ” (empty string).
For example, if -a requires an argument but -b does not, a command line of ‘-a one -b two three’ would result in option/arg pairs of (‘-a’, ‘one’) (‘-b’, ”), (”, ‘two’), (”, ‘three’) being processed.
Convert a network byte ordered string form of an IP address into human readable form.
Returns the integer representation of the ipaddr.
Returns a string containing the IP address representation.