Class: CassandraObject::Types::IntegerType
- Inherits:
-
BaseType
- Object
- BaseType
- CassandraObject::Types::IntegerType
show all
- Defined in:
- lib/cassandra_object/types/integer_type.rb
Constant Summary
collapse
- REGEX =
/\A[-+]?\d+\Z/
Instance Attribute Summary
Attributes inherited from BaseType
#options
Instance Method Summary
collapse
Methods inherited from BaseType
#default, #initialize, #wrap
Instance Method Details
#decode(str) ⇒ Object
10
11
12
13
|
# File 'lib/cassandra_object/types/integer_type.rb', line 10
def decode(str)
return nil if str.empty?
str.to_i
end
|
#encode(int) ⇒ Object
5
6
7
8
|
# File 'lib/cassandra_object/types/integer_type.rb', line 5
def encode(int)
raise ArgumentError.new("#{int.inspect} is not an Integer.") unless int.kind_of?(Integer)
int.to_s
end
|