Module: Redis::Helpers::Serialize
- Includes:
- Marshal
- Defined in:
- lib/redis/helpers/serialize.rb
Instance Method Summary collapse
Instance Method Details
#from_redis(value) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/redis/helpers/serialize.rb', line 16 def from_redis(value) return value unless [:marshal] case value when Array value.collect{|v| from_redis(v)} else restore(value) rescue value end end |
#to_redis(value) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/redis/helpers/serialize.rb', line 6 def to_redis(value) return value unless [:marshal] case value when String, Fixnum, Bignum, Float value else dump(value) end end |