Class: IntegerTypecaster

Inherits:
Typecaster show all
Defined in:
lib/type_casters.rb

Overview

Casts a value to an integer

Instance Method Summary collapse

Methods inherited from Typecaster

registered_typecasters, #typecast_on_write?, typecaster_for

Instance Method Details

#typeObject



37
# File 'lib/type_casters.rb', line 37

def type; 'integer' end

#typecast(value) ⇒ Object



39
40
41
# File 'lib/type_casters.rb', line 39

def typecast(value)
  value.to_i
end