Method: Code::Object::Decimal#initialize
- Defined in:
- lib/code/object/decimal.rb
#initialize(*args, **_kargs) ⇒ Decimal
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/code/object/decimal.rb', line 6 def initialize(*args, **_kargs, &) @raw = if args.first.class.in?(NUMBER_CLASSES) if args.second.class.in?(NUMBER_CLASSES) args.first.to_s.to_d * (10**args.second.to_s.to_d) else args.first.to_s.to_d end else 0.to_d end rescue FloatDomainError @raw = 0.to_d end |