Sets optional filename and line number that will be used in ERB
code evaluation and error reporting. See also filename=
and lineno=
erb = ERB.new('<%= some_x %>') erb.render # undefined local variable or method `some_x' # from (erb):1 erb.location = ['file.erb', 3] # All subsequent error reporting would use new location erb.render # undefined local variable or method `some_x' # from file.erb:4
Returns true if the ipaddr is a private address. IPv4 addresses in 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 as defined in RFC 1918 and IPv6 Unique Local Addresses in fc00::/7 as defined in RFC 4193 are considered private.
Returns the prefix length in bits for the ipaddr.
Sets the prefix length in bits
Returns true
iff the current severity level allows for the printing of ERROR
messages.
Sets the severity to ERROR.
Creates a matrix where rows
is an array of arrays, each of which is a row of the matrix. If the optional argument copy
is false, use the given arrays as the internal structure of the matrix without copying.
Matrix.rows([[25, 93], [-1, 66]]) => 25 93 -1 66
Returns row vector number i
of the matrix as a Vector
(starting at 0 like an array). When a block is given, the elements of that vector are iterated.
Returns true
if this is a matrix with only zero elements
Returns a matrix with entries rounded to the given precision (see Float#round
)
Returns a vector with entries rounded to the given precision (see Float#round
)
Returns true
iff all elements are zero.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Groups line break hints added in the block. The line break hints are all to be used or not.
If indent
is specified, the method call is regarded as nested by nest(indent) { … }.
If open_obj
is specified, text open_obj, open_width
is called before grouping. If close_obj
is specified, text close_obj, close_width
is called after grouping.
Returns true if value
is a prime number, else returns false.
value
an arbitrary integer to be checked.
generator
optional. A pseudo-prime generator.
Returns the names of all object hierarchies currently in the store.
WARNING: This method is only valid in a PStore#transaction
. It will raise PStore::Error
if called at any other time.
Returns true if the supplied name is currently in the data store.
WARNING: This method is only valid in a PStore#transaction
. It will raise PStore::Error
if called at any other time.
Returns the priority of thr. Default is inherited from the current thread which creating the new thread, or zero for the initial main thread; higher-priority thread will run more frequently than lower-priority threads (but lower-priority threads can also run).
This is just hint for Ruby thread scheduler. It may be ignored on some platform.
Thread.current.priority #=> 0
Sets the priority of thr to integer. Higher-priority threads will run more frequently than lower-priority threads (but lower-priority threads can also run).
This is just hint for Ruby thread scheduler. It may be ignored on some platform.
count1 = count2 = 0 a = Thread.new do loop { count1 += 1 } end a.priority = -1 b = Thread.new do loop { count2 += 1 } end b.priority = -2 sleep 1 #=> 1 count1 #=> 622504 count2 #=> 5832