Class: NegativeNumeric

Inherits:
Numeric
  • Object
show all
Defined in:
lib/negative_numeric.rb

Class Method Summary collapse

Class Method Details

.dump(numeric) ⇒ Object

Convert SymbolArray to DB format (string)


9
10
11
# File 'lib/negative_numeric.rb', line 9

def dump(numeric)
  (-1 * numeric.to_d)
end

.load(string) ⇒ Object

Convert DB format (string) to SymbolArray


4
5
6
# File 'lib/negative_numeric.rb', line 4

def load(string)
  (string.nil? ? 0.0 : string.to_d * -1)
end