Returns true
if mod is a singleton class or false
if it is an ordinary class or module.
class C end C.singleton_class? #=> false C.singleton_class.singleton_class? #=> true
Execute the provided block, but preserve the precision limit
BigDecimal.limit(100) puts BigDecimal.limit BigDecimal.save_limit do BigDecimal.limit(200) puts BigDecimal.limit end puts BigDecimal.limit
Converts a BigDecimal
to a String of the form “nnnnnn.mmm”. This method is deprecated; use BigDecimal#to_s
(“F”) instead.
require 'bigdecimal' require 'bigdecimal/util' d = BigDecimal.new("3.14") d.to_digits # => "3.14"
return the JSON
value
Deserializes JSON
string by converting numerator value n
, denominator value d
, to a Rational
object.
Returns a hash, that will be turned into a JSON
object and represent this object.
This method is equivalent to d >> n
This method is equivalent to d << n
This method is equivalent to d >> (n * 12)
This method is equivalent to d << (n * 12)
Deserializes JSON
string by converting Julian year y
, month m
, day d
and Day of Calendar Reform sg
to Date
.
Returns a hash, that will be turned into a JSON
object and represent this object.
Stores class name (Date
) with Julian year y
, month m
, day d
and Day of Calendar Reform sg
as JSON
string
Deserializes JSON
string by converting year y
, month m
, day d
, hour H
, minute M
, second S
, offset of
and Day of Calendar Reform sg
to DateTime
.
Returns a hash, that will be turned into a JSON
object and represent this object.
Stores class name (DateTime
) with Julian year y
, month m
, day d
, hour H
, minute M
, second S
, offset of
and Day of Calendar Reform sg
as JSON
string
Returns a hash, that will be turned into a JSON
object and represent this object.
Stores class name (Time
) with number of seconds since epoch and number of microseconds for Time
as JSON
string
Return the number of seconds the specified time zone differs from UTC.
Numeric
time zones that include minutes, such as -10:00
or +1330
will work, as will simpler hour-only time zones like -10
or +13
.
Textual time zones listed in ZoneOffset are also supported.
If the time zone does not match any of the above, zone_offset
will check if the local time zone (both with and without potential Daylight Saving Time changes being in effect) matches zone
. Specifying a value for year
will change the year used to find the local time zone.
If zone_offset
is unable to determine the offset, nil will be returned.