Permalink
Browse files

Nada

  • Loading branch information...
1 parent 243b973 commit cc5473406c57ec0105ee3c0e3cbcde3cb4649433 @levmatta-umanni levmatta-umanni committed Oct 12, 2011
Showing with 14 additions and 14 deletions.
  1. +14 −14 lib/cassandra-model/types.rb
View
28 lib/cassandra-model/types.rb
@@ -54,18 +54,18 @@ def self.dump(v)
ret = nil
if !v.blank?
case v
- when String
- if v.size == 8
- ret = Cassandra::Long.new(v)
- else
- ret = Cassandra::Long.new(::Time.strptime(v, '%FT%T%z').utc.to_i)
- end
- when Cassandra::Long
- ret =v
- when Time
- ret = Cassandra::Long.new(v.utc.to_i)
- when DateTime
- ret = Cassandra::Long.new(v.to_time.utc.to_i)
+ when String
+ if v.size == 8
+ ret = Cassandra::Long.new(v)
+ else
+ ret = Cassandra::Long.new(::Time.strptime(v, '%FT%T%z').utc.to_i)
+ end
+ when Cassandra::Long
+ ret =v
+ when Time
+ ret = Cassandra::Long.new(v.utc.to_i)
+ when DateTime
+ ret = Cassandra::Long.new(v.to_time.utc.to_i)
end
end
ret
@@ -94,12 +94,12 @@ def self.dump(v)
def self.load(v)
v == '1'
end
-
+
def self.object_to_boolean value
return [true, "true", 1, "1", "T", "t", "Y", "y", "yes"].include?(value.class == String ? value.downcase : value)
end
end
-
+
class TimeuuidType
def self.dump(v)
v && SimpleUUID::UUID.new(v).to_s

0 comments on commit cc54734

Please sign in to comment.