class Thrift::JSONPairContext

Context class for object member key-value pairs

Public Class Methods

new() click to toggle source
   # File lib/thrift/protocol/json_protocol.rb
80 def initialize
81   @first = true
82   @colon = true
83 end

Public Instance Methods

escapeNum() click to toggle source

Numbers must be turned into strings if they are the key part of a pair

    # File lib/thrift/protocol/json_protocol.rb
107 def escapeNum
108   return @colon
109 end
read(reader) click to toggle source
    # File lib/thrift/protocol/json_protocol.rb
 95 def read(reader)
 96   if (@first)
 97     @first = false
 98     @colon = true
 99   else
100     ch = (@colon ? @@kJSONPairSeparator : @@kJSONElemSeparator)
101     @colon = !@colon
102     JsonProtocol::read_syntax_char(reader, ch)
103   end
104 end
write(trans) click to toggle source
   # File lib/thrift/protocol/json_protocol.rb
85 def write(trans)
86   if (@first)
87     @first = false
88     @colon = true
89   else
90     trans.write(@colon ? @@kJSONPairSeparator : @@kJSONElemSeparator)
91     @colon = !@colon
92   end
93 end