Class: Thrift::JSONListContext

Inherits:
JSONContext show all
Defined in:
lib/thrift/protocol/json_protocol.rb

Overview

Context class for lists

Instance Method Summary collapse

Methods inherited from JSONContext

#escapeNum

Constructor Details

#initializeJSONListContext

Returns a new instance of JSONListContext.



115
116
117
# File 'lib/thrift/protocol/json_protocol.rb', line 115

def initialize
  @first = true
end

Instance Method Details

#read(reader) ⇒ Object



127
128
129
130
131
132
133
# File 'lib/thrift/protocol/json_protocol.rb', line 127

def read(reader)
  if (@first)
    @first = false
  else
    JsonProtocol::read_syntax_char(reader, @@kJSONElemSeparator)
  end
end

#write(trans) ⇒ Object



119
120
121
122
123
124
125
# File 'lib/thrift/protocol/json_protocol.rb', line 119

def write(trans)
  if (@first)
    @first = false
  else
    trans.write(@@kJSONElemSeparator)
  end
end