Class: BaseCRM::Coercion

Inherits:
Object
  • Object
show all
Defined in:
lib/basecrm/utils/coercion.rb

Class Method Summary collapse

Class Method Details

.to_decimal_value(value) ⇒ Object



5
6
7
# File 'lib/basecrm/utils/coercion.rb', line 5

def self.to_decimal_value(value)
  BigDecimal((value || 0), 15)
end

.to_string(value) ⇒ Object



9
10
11
12
13
14
# File 'lib/basecrm/utils/coercion.rb', line 9

def self.to_string(value)
  case value
  when BigDecimal then value.to_s('F')
  else value.to_s
  end
end