class Acfs::Resource::Attributes::Integer

@api public

Integer attribute type. Use it in your model as an attribute type:

@example

class User < Acfs::Resource
  attribute :name, :integer
end

Public Instance Methods

cast_value(value) click to toggle source

@api public

Cast given object to integer.

@param [Object] value Object to cast. @return [Fixnum] Casted object as fixnum.

# File lib/acfs/resource/attributes/integer.rb, line 21
def cast_value(value)
  if value.blank?
    0
  else
    Integer(value)
  end
end