Class: Garcon::Stash::Serializer::Default

Inherits:
None show all
Defined in:
lib/garcon/stash/serializer.rb

Overview

Default serializer which converts keys to strings and marshalls values.

Instance Method Summary collapse

Instance Method Details

#dump(value) ⇒ String

Serialize a value.

Parameters:

Returns:

  • (String)

    The value transformed to string.



71
72
73
# File 'lib/garcon/stash/serializer.rb', line 71

def dump(value)
  Marshal.dump(value)
end

#key_for(key) ⇒ String

Transform the key to a string.

Parameters:

Returns:

  • (String)

    The key transformed to string.



62
63
64
# File 'lib/garcon/stash/serializer.rb', line 62

def key_for(key)
  super(key.to_s)
end

#load(value) ⇒ Object

Parse a value.

Parameters:

Returns:

  • (Object)

    The deserialized value.



80
81
82
# File 'lib/garcon/stash/serializer.rb', line 80

def load(value)
  Marshal.load(value)
end