class DataMapper::Property::Integer

Public Class Methods

new(model, name, options = {}) click to toggle source

@api semipublic

Calls superclass method
# File lib/dm-core/property/integer.rb, line 11
def initialize(model, name, options = {})
  if options.key?(:serial) && !kind_of?(Serial)
    raise "Integer #{name} with explicit :serial option is deprecated, use Serial instead (#{caller[2]})"
  end
  super
end

Protected Instance Methods

typecast_to_primitive(value) click to toggle source

Typecast a value to an Integer

@param [#to_str, to_i] value

value to typecast

@return [Integer]

Integer constructed from value

@api private

# File lib/dm-core/property/integer.rb, line 27
def typecast_to_primitive(value)
  typecast_to_numeric(value, :to_i)
end