Sha256: e14fa0f0abca50338fc93ffc80d1201c4a4db43c938cfb1e0fae2fa454bf33f4

Contents?: true

Size: 517 Bytes

Versions: 9

Compression:

Stored size: 517 Bytes

Contents

module Kestrel
  class Client
    class Unmarshal < Proxy
      def get(keys, raw = false)
        response = client.get(keys, true)
        return response if raw
        if is_marshaled?(response)
          Marshal.load_with_constantize(response, loaded_constants = [])
        else
          response
        end
      end

      def is_marshaled?(object)
        object.to_s[0] == Marshal::MAJOR_VERSION && object.to_s[1] == Marshal::MINOR_VERSION
      rescue Exception
        false
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kestrel-client-0.4.1 lib/kestrel/client/unmarshal.rb
kestrel-client-0.4.0 lib/kestrel/client/unmarshal.rb
kestrel-client-0.3.1 lib/kestrel/client/unmarshal.rb
kestrel-client-0.3.0 lib/kestrel/client/unmarshal.rb
kestrel-client-0.2.4 lib/kestrel/client/unmarshal.rb
kestrel-client-0.2.3 lib/kestrel/client/unmarshal.rb
kestrel-client-0.2.2 lib/kestrel/client/unmarshal.rb
kestrel-client-0.2.1 lib/kestrel/client/unmarshal.rb
kestrel-client-0.2.0 lib/kestrel/client/unmarshal.rb