Module: Couchbase::Transcoder::Marshal
- Defined in:
- lib/couchbase/transcoder.rb
Class Method Summary collapse
Class Method Details
.dump(obj, flags, options = {}) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/couchbase/transcoder.rb', line 75 def self.dump(obj, flags, = {}) [ ::Marshal.dump(obj), (flags & ~Bucket::FMT_MASK) | Bucket::FMT_MARSHAL ] end |
.load(blob, flags, options = {}) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/couchbase/transcoder.rb', line 82 def self.load(blob, flags, = {}) if (flags & Bucket::FMT_MASK) == Bucket::FMT_MARSHAL || [:forced] ::Marshal.load(blob) else if Compat.enabled? return Compat.guess_and_load(blob, flags, ) else raise ArgumentError, "unexpected flags (0x%02x instead of 0x%02x)" % [flags, Bucket::FMT_MARSHAL] end end end |