summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Geyer <jensg@apache.org>2013-08-14 21:33:16 +0200
committerJens Geyer <jensg@apache.org>2013-08-14 21:33:53 +0200
commit3bb141d3689f0778af3dcf3218cfe760c36803bc (patch)
tree43ebb183201f25d4e3ba5240617aaf37b0ec967d
parent1bb0ed88f240641a090edb075592ef2ca9ee80c5 (diff)
downloadthrift-3bb141d3689f0778af3dcf3218cfe760c36803bc.tar.gz
THRIFT-2036 Thrift gem warns about class variable access from top level
Patch: Takuya Hashimoto & Keith Barrette
-rw-r--r--lib/rb/lib/thrift/protocol/json_protocol.rb33
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/rb/lib/thrift/protocol/json_protocol.rb b/lib/rb/lib/thrift/protocol/json_protocol.rb
index 8694b7d09..2e8508911 100644
--- a/lib/rb/lib/thrift/protocol/json_protocol.rb
+++ b/lib/rb/lib/thrift/protocol/json_protocol.rb
@@ -18,21 +18,6 @@
# under the License.
#
-@@kJSONObjectStart = '{'
-@@kJSONObjectEnd = '}'
-@@kJSONArrayStart = '['
-@@kJSONArrayEnd = ']'
-@@kJSONNewline = '\n'
-@@kJSONElemSeparator = ','
-@@kJSONPairSeparator = ':'
-@@kJSONBackslash = '\\'
-@@kJSONStringDelimiter = '"'
-
-@@kThriftVersion1 = 1
-
-@@kThriftNan = "NaN"
-@@kThriftInfinity = "Infinity"
-@@kThriftNegativeInfinity = "-Infinity"
module Thrift
class LookaheadReader
@@ -66,6 +51,7 @@ module Thrift
# implementations
#
class JSONContext
+ @@kJSONElemSeparator = ','
#
# Write context data to the trans. Default is to do nothing.
#
@@ -89,6 +75,8 @@ module Thrift
# Context class for object member key-value pairs
class JSONPairContext < JSONContext
+ @@kJSONPairSeparator = ':'
+
def initialize
@first = true
@colon = true
@@ -146,6 +134,21 @@ module Thrift
end
class JsonProtocol < BaseProtocol
+
+ @@kJSONObjectStart = '{'
+ @@kJSONObjectEnd = '}'
+ @@kJSONArrayStart = '['
+ @@kJSONArrayEnd = ']'
+ @@kJSONNewline = '\n'
+ @@kJSONBackslash = '\\'
+ @@kJSONStringDelimiter = '"'
+
+ @@kThriftVersion1 = 1
+
+ @@kThriftNan = "NaN"
+ @@kThriftInfinity = "Infinity"
+ @@kThriftNegativeInfinity = "-Infinity"
+
def initialize(trans)
super(trans)
@context = JSONContext.new