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
81 def initialize
82   @first = true
83   @colon = true
84 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
108 def escapeNum
109   return @colon
110 end
read(reader) click to toggle source
    # File lib/thrift/protocol/json_protocol.rb
 96 def read(reader)
 97   if (@first)
 98     @first = false
 99     @colon = true
100   else
101     ch = (@colon ? @@kJSONPairSeparator : @@kJSONElemSeparator)
102     @colon = !@colon
103     JsonProtocol::read_syntax_char(reader, ch)
104   end
105 end
write(trans) click to toggle source
   # File lib/thrift/protocol/json_protocol.rb
86 def write(trans)
87   if (@first)
88     @first = false
89     @colon = true
90   else
91     trans.write(@colon ? @@kJSONPairSeparator : @@kJSONElemSeparator)
92     @colon = !@colon
93   end
94 end