Class: ParamsReady::Value::DecimalCoder

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

Direct Known Subclasses

FormattedDecimalCoder

Class Method Summary collapse

Methods inherited from Coder

instance

Methods included from Coercion

#strict_default?, #try_coerce

Methods inherited from AbstractCoder

value_class_name

Methods included from Extensions::ClassReaderWriter

#class_reader_writer

Class Method Details

.coerce(input, _) ⇒ Object



116
117
118
119
# File 'lib/params_ready/value/coder.rb', line 116

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

.format(value, format) ⇒ Object



121
122
123
# File 'lib/params_ready/value/coder.rb', line 121

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