Module: AnyCache::Dumper Private
- Defined in:
- lib/any_cache/dumper.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: InterfaceAccessMixin
Class Method Summary collapse
- .detransform_hash(hash) ⇒ Hash private
- .dump(value) ⇒ String private
- .load(value) ⇒ Object private
- .transform_hash(hash) ⇒ Hash private
Class Method Details
.detransform_hash(hash) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 33 |
# File 'lib/any_cache/dumper.rb', line 27 def detransform_hash(hash) {}.tap do |entries| hash.each_pair do |key, value| entries[key] = load(value) end end end |
.dump(value) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 43 |
# File 'lib/any_cache/dumper.rb', line 40 def dump(value) return value if value.nil? Zlib::Deflate.deflate(Marshal.dump(value)) end |
.load(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 53 |
# File 'lib/any_cache/dumper.rb', line 50 def load(value) return value if value.nil? Marshal.load(Zlib::Inflate.inflate(value)) end |
.transform_hash(hash) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 |
# File 'lib/any_cache/dumper.rb', line 14 def transform_hash(hash) {}.tap do |entries| hash.each_pair do |key, value| entries[key] = dump(value) end end end |