Class: Couchbase::Transcoder::Document
- Inherits:
-
Base
- Object
- Java::NetSpyMemcachedTranscoders::SerializingTranscoder
- Base
- Couchbase::Transcoder::Document
- Defined in:
- lib/couchbase/transcoder.rb
Instance Method Summary collapse
Instance Method Details
#decode(d) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/couchbase/transcoder.rb', line 29 def decode(d) decoded = super data = if decoded.respond_to?(:to_str) decoded else decoded.getData.to_s end MultiJson.load(data) rescue MultiJson::LoadError ::Marshal.load(data) end |
#encode(o) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/couchbase/transcoder.rb', line 42 def encode(o) super MultiJson.dump(o) rescue ArgumentError => e ex = Couchbase::Error::ValueFormat.new ex.inner_exception = e fail ex end |