Sha256: 97e4975e36de34cf4692139fbc01bdc326cec2e9cc4613f4ea37b32a2b1f509d
Contents?: true
Size: 539 Bytes
Versions: 117
Compression:
Stored size: 539 Bytes
Contents
module CassandraObject module Types module IntegerType REGEX = /\A[-+]?\d+\Z/ def encode(int) raise ArgumentError.new("#{self} requires an Integer. You passed #{int.inspect}") unless int.kind_of?(Integer) int.to_s end module_function :encode def decode(str) return nil if str.empty? raise ArgumentError.new("Cannot convert #{str} into an Integer") unless str.kind_of?(String) && str.match(REGEX) str.to_i end module_function :decode end end end
Version data entries
117 entries across 117 versions & 2 rubygems