Sha256: a86d850b5407dad6e57a05e01526e31027ab3c0b82e0d884b0100c5f4a1a83cc

Contents?: true

Size: 348 Bytes

Versions: 13

Compression:

Stored size: 348 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
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
gotime-cassandra_object-4.10.5 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.10.4 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.10.3 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.10.2 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.10.1 lib/cassandra_object/types/integer_type.rb
cassandra_object_rails-0.0.1 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.10.0 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.9.2 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.9.1 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.9.0 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.8.1 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.8.0 lib/cassandra_object/types/integer_type.rb
gotime-cassandra_object-4.7.3 lib/cassandra_object/types/integer_type.rb