Class: ParamsReady::Value::DecimalCoder

Inherits:
Coder
  • Object
show all
Defined in:
lib/params_ready/value/coder.rb

Direct Known Subclasses

FormattedDecimalCoder

Class Method Summary collapse

Methods inherited from Coder

strict_default?, try_coerce, value_class_name

Methods included from Extensions::ClassReaderWriter

#class_reader_writer

Class Method Details

.coerce(input, _) ⇒ Object



85
86
87
88
# File 'lib/params_ready/value/coder.rb', line 85

def self.coerce(input, _)
  return nil if input.nil? || input == ''
  BigDecimal(input)
end

.format(value, format) ⇒ Object



90
91
92
# File 'lib/params_ready/value/coder.rb', line 90

def self.format(value, format)
  value.to_s('F')
end