Class: Acfs::Resource::Attributes::Integer
- Defined in:
- lib/acfs/resource/attributes/integer.rb
Overview
Integer attribute type. Use it in your model as an attribute type:
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#cast_value(value) ⇒ Fixnum
Cast given object to integer.
Methods inherited from Base
#cast, #default_value, #initialize
Constructor Details
This class inherits a constructor from Acfs::Resource::Attributes::Base
Instance Method Details
#cast_value(value) ⇒ Fixnum
Cast given object to integer.
21 22 23 24 25 26 27 |
# File 'lib/acfs/resource/attributes/integer.rb', line 21 def cast_value(value) if value.blank? 0 else Integer(value) end end |