Returns the number of the signal that caused the process to stop, or nil
if the process is not stopped.
Create a new BackReferenceReadNode
node
Create a new ConstantOrWriteNode
node
Create a new ConstantPathOperatorWriteNode
node
Create a new KeywordRestParameterNode
node
Create a new RegularExpressionNode
node
Create a new RequiredKeywordParameterNode
node
Restore session state from the session’s FileStore
file.
Returns the session state as a hash.
Restore (empty) session state.
Returns self
.
Returns 1
.
Returns the Complex object created from the numerators of the real and imaginary parts of self
, after converting each part to the lowest common denominator of the two:
c = Complex(Rational(2, 3), Rational(3, 4)) # => ((2/3)+(3/4)*i) c.numerator # => (8+9i)
In this example, the lowest common denominator of the two parts is 12; the two converted parts may be thought of as Rational(8, 12) and Rational(9, 12), whose numerators, respectively, are 8 and 9; so the returned value of c.numerator
is Complex(8, 9)
.
Related: Complex#denominator
.
Returns the denominator of self
, which is the least common multiple of self.real.denominator
and self.imag.denominator
:
Complex.rect(Rational(1, 2), Rational(2, 3)).denominator # => 6
Note that n.denominator
of a non-rational numeric is 1
.
Related: Complex#numerator
.
Returns the numerator.
Returns the denominator (always positive).
Returns the numerator. The result is machine dependent.
n = 0.3.numerator #=> 5404319552844595 d = 0.3.denominator #=> 18014398509481984 n.fdiv(d) #=> 0.3
See also Float#denominator
.
Returns the denominator (always positive). The result is machine dependent.
See also Float#numerator
.
Calls the block with each entry name in the directory at dirpath
; sets the given encoding onto each passed entry_name
:
Dir.foreach('/example') {|entry_name| p entry_name }
Output:
"config.h" "lib" "main.rb" ".." "."
Encoding:
Dir.foreach('/example') {|entry_name| p entry_name.encoding; break } Dir.foreach('/example', encoding: 'US-ASCII') {|entry_name| p entry_name.encoding; break }
Output:
#<Encoding:UTF-8> #<Encoding:US-ASCII>
See String Encoding.
Returns an enumerator if no block is given.
Returns the numerator.
Rational(7).numerator #=> 7 Rational(7, 1).numerator #=> 7 Rational(9, -4).numerator #=> -9 Rational(-2, -10).numerator #=> 1
Returns the denominator (always positive).
Rational(7).denominator #=> 1 Rational(7, 1).denominator #=> 1 Rational(9, -4).denominator #=> 4 Rational(-2, -10).denominator #=> 5
Returns true
if the date is on or after the date of calendar reform, false
otherwise:
Date.new(1582, 10, 15).gregorian? # => true (Date.new(1582, 10, 15) - 1).gregorian? # => false
Equivalent to Date#new_start
with argument Date::GREGORIAN
.