Sha256: aa8e82e1e0c95050678a66ff9945c9149708c6e0974ed87c31dda49557cc172c
Contents?: true
Size: 858 Bytes
Versions: 43
Compression:
Stored size: 858 Bytes
Contents
# frozen_string_literal: true require "active_model/type/integer" module ActiveModel module Type # = Active Model \BigInteger \Type # # Attribute type for integers that can be serialized to an unlimited number # of bytes. This type is registered under the +:big_integer+ key. # # class Person # include ActiveModel::Attributes # # attribute :id, :big_integer # end # # person = Person.new # person.id = "18_000_000_000" # # person.id # => 18000000000 # # All casting and serialization are performed in the same way as the # standard ActiveModel::Type::Integer type. class BigInteger < Integer def serialize_cast_value(value) # :nodoc: value end private def max_value ::Float::INFINITY end end end end
Version data entries
43 entries across 43 versions & 6 rubygems