Returns a copy of the vector.
Returns the modulus (Pythagorean distance) of the vector.
Vector[5,8,2].r => 9.643650761
Initializes a new instance and evaluates the optional block in context of the instance. Arguments args
are passed to new
, see there for description of parameters.
This method is deprecated, its behavior corresponds to the older new
method.
Puts option summary into to
and returns to
. Yields each line if a block is given.
to
Output destination, which must have method <<. Defaults to [].
width
Width of left side, defaults to @summary_width.
max
Maximum length allowed for left side, defaults to width
- 1.
indent
Indentation, defaults to @summary_indent.
Add option switch and handler. See make_switch
for an explanation of parameters.
Traverses @stack, sending each element method id
with args
and block
.
Searches key
in @stack for id
hash and returns or yields the result.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Returns the path to the data store file.
Ends the current PStore#transaction
, committing any changes to the data store immediately.
require "pstore" store = PStore.new("data_file.pstore") store.transaction do # begin transaction # load some data into the store... store[:one] = 1 store[:two] = 2 store.commit # end transaction here, committing changes store[:three] = 3 # this change is never reached end
WARNING: This method is only valid in a PStore#transaction
. It will raise PStore::Error
if called at any other time.
Ends the current PStore#transaction
, discarding any changes to the data store.
require "pstore" store = PStore.new("data_file.pstore") store.transaction do # begin transaction store[:one] = 1 # this change is not applied, see below... store[:two] = 2 # this change is not applied, see below... store.abort # end transaction here, discard all changes store[:three] = 3 # this change is never reached end
WARNING: This method is only valid in a PStore#transaction
. It will raise PStore::Error
if called at any other time.
provides a unified clone
operation, for REXML::XPathParser
to use across multiple Object
types
Returns the absolute value of int
.
-12345.abs #=> 12345 12345.abs #=> 12345 -1234567890987654321.abs #=> 1234567890987654321
Returns the array including the digits extracted by place-value notation with radix base
of int
.
base
should be greater than or equal to 2.
12345.digits #=> [5, 4, 3, 2, 1] 12345.digits(7) #=> [4, 6, 6, 0, 5] 12345.digits(100) #=> [45, 23, 1] -12345.digits(7) #=> Math::DomainError
Removes all elements and returns self.
Returns the full path name of the temporary file. This will be nil if unlink
has been called.
Terminates the currently running thread and schedules another thread to be run.
If this thread is already marked to be killed, ::exit
returns the Thread
.
If this is the main thread, or the last thread, exit the process.
Give the thread scheduler a hint to pass execution to another thread. A running thread may or may not switch, it depends on OS and processor.
Terminates thr
and schedules another thread to be run.
If this thread is already marked to be killed, exit
returns the Thread
.
If this is the main thread, or the last thread, exits the process.
The reason this block was terminated: :break, :redo, :retry, :next, :return, or :noreason.
Returns a clone of this method.
class A def foo return "bar" end end m = A.new.method(:foo) m.call # => "bar" n = m.clone.call # => "bar"
Returns a clone of this method.
class A def foo return "bar" end end m = A.new.method(:foo) m.call # => "bar" n = m.clone.call # => "bar"
Path of the file being run