Class: Couchbase::JsonTranscoder
- Inherits:
-
Object
- Object
- Couchbase::JsonTranscoder
- Defined in:
- lib/couchbase/json_transcoder.rb
Instance Method Summary collapse
-
#decode(blob, flags) ⇒ Object
Object decoded document.
-
#encode(document) ⇒ Array<String, Integer>
Pair of encoded document and flags.
Instance Method Details
#decode(blob, flags) ⇒ Object
Returns Object decoded document.
28 29 30 |
# File 'lib/couchbase/json_transcoder.rb', line 28 def decode(blob, flags) JSON.parse(blob) unless blob.nil? end |
#encode(document) ⇒ Array<String, Integer>
Returns pair of encoded document and flags.
21 22 23 |
# File 'lib/couchbase/json_transcoder.rb', line 21 def encode(document) [JSON.generate(document), (0x02 << 24) | 0x06] end |