@private
# File lib/aws/record/attributes.rb, line 220 def self.allow_set? true end
Returns a serialized representation of the integer value suitable for storing in SimpleDB.
attribute.serialize(123) #=> '123'
@param [Integer] integer The number to serialize. @param [Hash] options @return [String] A serialized representation of the integer.
# File lib/aws/record/attributes.rb, line 215 def self.serialize integer, options = {} expect(Integer, integer) { integer } end
Returns value cast to an integer. Empty strings are cast to nil by default. Type casting is done by calling to_i on the value.
int_attribute.type_cast('123') #=> 123 int_attribute.type_cast('') #=> nil
@param [Mixed] value The value to type cast to an integer. @return [Integer,nil] Returns the type casted integer or nil
# File lib/aws/record/attributes.rb, line 194 def self.type_cast raw_value, options = {} case raw_value when nil then nil when '' then nil when Integer then raw_value else raw_value.respond_to?(:to_i) ? raw_value.to_i : raw_value.to_s.to_i end end