Returns a copy of the vector.
Creates a single-row matrix from this vector.
Overrides Object#inspect
Returns an incremented value of default
according to arg
.
Directs to reject specified class argument.
t
Argument class specifier, any object including Class
.
reject(t)
Add option switch and handler. See make_switch
for an explanation of parameters.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Returns an incremented value of default
according to arg
.
Directs to reject specified class argument.
t
Argument class specifier, any object including Class
.
reject(t)
See reject
.
Add option switch and handler. See make_switch
for an explanation of parameters.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Returns a printable version of mtch.
puts /.$/.match("foo").inspect #=> #<MatchData "o"> puts /(.)(.)(.)/.match("foo").inspect #=> #<MatchData "foo" 1:"f" 2:"o" 3:"o"> puts /(.)(.)?(.)/.match("fo").inspect #=> #<MatchData "fo" 1:"f" 2:nil 3:"o"> puts /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge").inspect #=> #<MatchData "hog" foo:"h" bar:"o" baz:"g">
Iterates the given block int
times, passing in values from zero to int - 1
.
If no block is given, an Enumerator
is returned instead.
5.times do |i| print i, " " end #=> 0 1 2 3 4
Rounds int
to a given precision in decimal digits (default 0 digits).
Precision may be negative. Returns a floating point number when ndigits
is positive, self
for zero, and round down for negative.
1.round #=> 1 1.round(2) #=> 1.0 15.round(-1) #=> 20
Returns true if the set contains the given object.
Note that include?
and member?
do not test member equality using ==
as do other Enumerables.
See also Enumerable#include?
Returns true if the set and the given set have at least one element in common.
e.g.:
require 'set' Set[1, 2, 3].intersect? Set[4, 5] # => false Set[1, 2, 3].intersect? Set[3, 4] # => true
Equivalent to Set#delete_if
, but returns nil if no changes were made.
Deletes every element that appears in the given enumerable object and returns self.
Returns a string containing a human-readable representation of the set. (“#<Set: {element1, element2, …}>”)