A convenience method which is same as follows:
group(1, '#<' + obj.class.name, '>') { ... }
UNTESTED
Called when the doctype is done
Displays an error statement
to the error output location. Asks a question
if given.
Is code
a client error status?
Is code
a server error status?
Is code
a client error status?
Is code
a server error status?
Iterates the given block, passing in integer values from int
up to and including limit
.
If no block is given, an Enumerator
is returned instead.
For example:
5.upto(10) { |i| print i, " " } #=> 5 6 7 8 9 10
Iterates the given block, passing decreasing values from int
down to and including limit
.
If no block is given, an Enumerator
is returned instead.
5.downto(1) { |n| print n, ".. " } print " Liftoff!\n" #=> "5.. 4.. 3.. 2.. 1.. Liftoff!"
Returns self.
Returns 1.
Returns the numerator.
1 2 3+4i <- numerator - + -i -> ---- 2 3 6 <- denominator c = Complex('1/2+2/3i') #=> ((1/2)+(2/3)*i) n = c.numerator #=> (3+4i) d = c.denominator #=> 6 n / d #=> ((1/2)+(2/3)*i) Complex(Rational(n.real, d), Rational(n.imag, d)) #=> ((1/2)+(2/3)*i)
See denominator.
Returns the denominator (lcm of both denominator - real and imag).
See numerator.
Returns the numerator.
Returns the denominator (always positive).
Convert self
to ISO-2022-JP
Convert self
to EUC-JP
Convert self
to Shift_JIS
Convert self
to UTF-8
Convert self
to UTF-16
Convert self
to UTF-32
Iterates through successive values, starting at str and ending at other_str inclusive, passing each value in turn to the block. The String#succ
method is used to generate each value. If optional second argument exclusive is omitted or is false, the last value will be included; otherwise it will be excluded.
If no block is given, an enumerator is returned instead.
"a8".upto("b6") {|s| print s, ' ' } for s in "a8".."b6" print s, ' ' end
produces:
a8 a9 b0 b1 b2 b3 b4 b5 b6 a8 a9 b0 b1 b2 b3 b4 b5 b6
If str and other_str contains only ascii numeric characters, both are recognized as decimal numbers. In addition, the width of string (e.g. leading zeros) is handled appropriately.
"9".upto("11").to_a #=> ["9", "10", "11"] "25".upto("5").to_a #=> [] "07".upto("11").to_a #=> ["07", "08", "09", "10", "11"]