Method: Couchbase::JsonTranscoder#encode
- Defined in:
- lib/couchbase/json_transcoder.rb
#encode(document) ⇒ Array<String, Integer>
Returns pair of encoded document and flags.
25 26 27 28 29 |
# File 'lib/couchbase/json_transcoder.rb', line 25 def encode(document) raise Error::EncodingFailure, "The JsonTranscoder does not support binary data" if document.is_a?(String) && !document.valid_encoding? [JSON.generate(document), TranscoderFlags.new(format: :json, lower_bits: 6).encode] end |