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, line 91
def initialize
  @first = true
  @colon = true
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, line 118
def escapeNum
  return @colon
end
read(reader) click to toggle source
# File lib/thrift/protocol/json_protocol.rb, line 106
def read(reader)
  if (@first)
    @first = false
    @colon = true
  else
    ch = (@colon ? @@kJSONPairSeparator : @@kJSONElemSeparator)
    @colon = !@colon
    JsonProtocol::read_syntax_char(reader, ch)
  end
end
write(trans) click to toggle source
# File lib/thrift/protocol/json_protocol.rb, line 96
def write(trans)
  if (@first)
    @first = false
    @colon = true
  else
    trans.write(@colon ? @@kJSONPairSeparator : @@kJSONElemSeparator)
    @colon = !@colon
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.