Class: Superstore::Types::IntegerType

Inherits:
ActiveModel::Type::Value
  • Object
show all
Defined in:
lib/superstore/types/integer_type.rb

Instance Method Summary collapse

Instance Method Details

#cast_value(value) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/superstore/types/integer_type.rb', line 4

def cast_value(value)
  if value.is_a?(String)
    Integer(value, 10)
  else
    Integer(value)
  end
rescue
end