BigDecimal

BigDecimal(*args) Instance Public methods

Complex

Complex(x[, y]) â numeric Instance Public methods Returns x+i*y; Complex(1, 2) #=> (1+2i) Complex('1+2i') #=> (1+2i) Complex(nil) #=> TypeError Complex(1, nil) #=> TypeError Syntax of string form: string form = extra spaces , complex , extra spaces ; complex = real part | [ sign ] , imaginary part | real part , sign , imaginary part | rational , "@" , rational ; real part = rational ; imaginary part = imaginary unit | unsigned rational , ima

Float

Float(arg) â float Instance Public methods Returns arg converted to a float. Numeric types are converted directly, the rest are converted using arg.to_f. As of Ruby 1.8, converting nil generates a TypeError. Float(1) #=> 1.0 Float("123.456") #=> 123.456

Hash

Hash(arg) â hash Instance Public methods Converts arg to a Hash by calling arg.to_hash. Returns an empty Hash when arg is nil or []. Hash([]) #=> {} Hash(nil) #=> nil Hash(key: :value) #=> {:key => :value} Hash([1, 2, 3]) #=> TypeError

Integer

Integer(arg,base=0) â integer Instance Public methods Converts arg to a Fixnum or Bignum. Numeric types are converted directly (with floating point numbers being truncated). base (0, or between 2 and 36) is a base for integer string representation. If arg is a String, when base is omitted or equals to zero, radix indicators (0, 0b, and 0x) are honored. In any case, strings should be strictly conformed to numeric representation. This behavior is different from that of String

Pathname

Pathname(p1) Instance Public methods Creates a new Pathname object.

Rational

Rational(x[, y]) â numeric Instance Public methods Returns x/y; Rational(1, 2) #=> (1/2) Rational('1/2') #=> (1/2) Rational(nil) #=> TypeError Rational(1, nil) #=> TypeError Syntax of string form: string form = extra spaces , rational , extra spaces ; rational = [ sign ] , unsigned rational ; unsigned rational = numerator | numerator , "/" , denominator ; numerator = integer part | fractional part | integer part , fractional part ; denominator = digits ; integ

String

String(arg) â string Instance Public methods Returns arg as an String. First tries to call its to_str method, then its to_s method. String(self) #=> "main" String(self.class) #=> "Object" String(123456) #=> "123456"

__callee__

__callee__() Instance Public methods

__dir__

__dir__ â string Instance Public methods Returns the canonicalized absolute path of the directory of the file from which this method is called. It means symlinks in the path is resolved. If __FILE__ is nil, it returns nil. The return value equals to File.dirname(File.realpath(__FILE__)).