Class: Kiss::Format::Integer

Inherits:
Kiss::Format show all
Defined in:
lib/kiss/format.rb

Class Method Summary collapse

Methods inherited from Kiss::Format

inherited, lookup

Class Method Details

.parse(value, context = {}) ⇒ Object



43
44
45
# File 'lib/kiss/format.rb', line 43

def parse(value, context = {})
  value.to_i
end

.validate(value, context = {}) ⇒ Object



47
48
49
50
# File 'lib/kiss/format.rb', line 47

def validate(value, context = {})
  # remove commas for thousands
  value.blank? ? nil : super(value.gsub(/[\$,]/, ''), context)
end

.value_to_s(value, context = {}) ⇒ Object



52
53
54
55
# File 'lib/kiss/format.rb', line 52

def value_to_s(value, context = {})
  # add commas for thousands
  value
end