Sha256: 31acda02ada5cadd5af26b6ae8241cda9f701dfa84c20558f960eaee491ff885

Contents?: true

Size: 377 Bytes

Versions: 1

Compression:

Stored size: 377 Bytes

Contents

class Redis
  module Serialize
    include Marshal

    def to_redis(value)
      case value
      when String, Fixnum, Bignum, Float
        value
      else
        dump(value)
      end
    end
    
    def from_redis(value)
      case value
      when Array
        value.collect{|v| from_redis(v)}
      else
        restore(value) rescue value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis-objects-0.2.1 lib/redis/serialize.rb