module Readthis::Passthrough

The `Passthrough` serializer performs no encoding on objects. It should be used when caching simple string objects when the overhead of marshalling or other serialization isn't desired.

Public Class Methods

dump(value) click to toggle source

Dump an object to string, without performing any encoding on it.

@param [Object] value Any object to be dumped as a string. Frozen strings

will be duplicated.

@return [String] The converted object.

# File lib/readthis/passthrough.rb, line 15
def self.dump(value)
  case value
  when String then value.dup
  else value.to_s
  end
end
load(value) click to toggle source

Load an object without modifying it at all.

@param [String] value The object to return, expected to be a string.

@return [String] The original value.

# File lib/readthis/passthrough.rb, line 27
def self.load(value)
  value
end