Sha256: 2a7ed153414b4de32aa7baae5ca155543379eb86e605f5b5393a3eb1da3ee9c0

Contents?: true

Size: 404 Bytes

Versions: 21

Compression:

Stored size: 404 Bytes

Contents

module CassandraObject
  module Types
    class IntegerType < BaseType
      REGEX = /\A[-+]?\d+\Z/
      def encode(int)
        raise ArgumentError.new("#{int.inspect} is not an Integer.") unless int.kind_of?(Integer)
        int.to_s
      end

      def decode(str)
        return nil if str.empty?
        str.to_i
      end

      def typecast(value)
        value.to_i
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
extendi-cassandra_object-1.1.1 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.1.0 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.20 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.19 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.18 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.17 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.16 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.15 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.14 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.13 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.12 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.11 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.10 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.9 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.8 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.7 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.6 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.5 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.4 lib/cassandra_object/types/integer_type.rb
extendi-cassandra_object-1.0.1 lib/cassandra_object/types/integer_type.rb