scout 5.7.1 → 5.7.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. data/CHANGELOG.markdown +5 -0
  2. data/lib/scout/command/run.rb +1 -1
  3. data/lib/scout/server.rb +2 -1
  4. data/lib/scout/streamer.rb +3 -2
  5. data/lib/scout/streamer_daemon.rb +4 -4
  6. data/lib/scout/version.rb +1 -1
  7. data/test/scout_test.rb +7 -8
  8. data/vendor/httpclient/README.txt +759 -0
  9. data/vendor/httpclient/bin/httpclient +65 -0
  10. data/vendor/httpclient/lib/hexdump.rb +50 -0
  11. data/vendor/httpclient/lib/http-access2.rb +55 -0
  12. data/vendor/httpclient/lib/http-access2/cookie.rb +1 -0
  13. data/vendor/httpclient/lib/http-access2/http.rb +1 -0
  14. data/vendor/httpclient/lib/httpclient.rb +1156 -0
  15. data/vendor/httpclient/lib/httpclient/auth.rb +899 -0
  16. data/vendor/httpclient/lib/httpclient/cacert.p7s +1912 -0
  17. data/vendor/httpclient/lib/httpclient/connection.rb +88 -0
  18. data/vendor/httpclient/lib/httpclient/cookie.rb +438 -0
  19. data/vendor/httpclient/lib/httpclient/http.rb +1046 -0
  20. data/vendor/httpclient/lib/httpclient/include_client.rb +83 -0
  21. data/vendor/httpclient/lib/httpclient/session.rb +1025 -0
  22. data/vendor/httpclient/lib/httpclient/ssl_config.rb +403 -0
  23. data/vendor/httpclient/lib/httpclient/timeout.rb +140 -0
  24. data/vendor/httpclient/lib/httpclient/util.rb +178 -0
  25. data/vendor/httpclient/lib/httpclient/version.rb +3 -0
  26. data/vendor/httpclient/lib/oauthclient.rb +110 -0
  27. data/vendor/httpclient/sample/async.rb +8 -0
  28. data/vendor/httpclient/sample/auth.rb +11 -0
  29. data/vendor/httpclient/sample/cookie.rb +18 -0
  30. data/vendor/httpclient/sample/dav.rb +103 -0
  31. data/vendor/httpclient/sample/howto.rb +49 -0
  32. data/vendor/httpclient/sample/oauth_buzz.rb +57 -0
  33. data/vendor/httpclient/sample/oauth_friendfeed.rb +59 -0
  34. data/vendor/httpclient/sample/oauth_salesforce_10.rb +63 -0
  35. data/vendor/httpclient/sample/oauth_twitter.rb +61 -0
  36. data/vendor/httpclient/sample/ssl/0cert.pem +22 -0
  37. data/vendor/httpclient/sample/ssl/0key.pem +30 -0
  38. data/vendor/httpclient/sample/ssl/1000cert.pem +19 -0
  39. data/vendor/httpclient/sample/ssl/1000key.pem +18 -0
  40. data/vendor/httpclient/sample/ssl/htdocs/index.html +10 -0
  41. data/vendor/httpclient/sample/ssl/ssl_client.rb +22 -0
  42. data/vendor/httpclient/sample/ssl/webrick_httpsd.rb +29 -0
  43. data/vendor/httpclient/sample/stream.rb +21 -0
  44. data/vendor/httpclient/sample/thread.rb +27 -0
  45. data/vendor/httpclient/sample/wcat.rb +21 -0
  46. data/vendor/httpclient/test/ca-chain.cert +44 -0
  47. data/vendor/httpclient/test/ca.cert +23 -0
  48. data/vendor/httpclient/test/client.cert +19 -0
  49. data/vendor/httpclient/test/client.key +15 -0
  50. data/vendor/httpclient/test/helper.rb +129 -0
  51. data/vendor/httpclient/test/htdigest +1 -0
  52. data/vendor/httpclient/test/htpasswd +2 -0
  53. data/vendor/httpclient/test/runner.rb +2 -0
  54. data/vendor/httpclient/test/server.cert +19 -0
  55. data/vendor/httpclient/test/server.key +15 -0
  56. data/vendor/httpclient/test/sslsvr.rb +65 -0
  57. data/vendor/httpclient/test/subca.cert +21 -0
  58. data/vendor/httpclient/test/test_auth.rb +321 -0
  59. data/vendor/httpclient/test/test_cookie.rb +391 -0
  60. data/vendor/httpclient/test/test_hexdump.rb +14 -0
  61. data/vendor/httpclient/test/test_http-access2.rb +507 -0
  62. data/vendor/httpclient/test/test_httpclient.rb +1783 -0
  63. data/vendor/httpclient/test/test_include_client.rb +52 -0
  64. data/vendor/httpclient/test/test_ssl.rb +235 -0
  65. data/vendor/multi_json/.document +5 -0
  66. data/vendor/multi_json/.rspec +3 -0
  67. data/vendor/multi_json/.travis.yml +11 -0
  68. data/vendor/multi_json/.yardopts +6 -0
  69. data/vendor/multi_json/CHANGELOG.md +169 -0
  70. data/vendor/multi_json/CONTRIBUTING.md +46 -0
  71. data/vendor/multi_json/Gemfile +31 -0
  72. data/vendor/multi_json/LICENSE.md +20 -0
  73. data/vendor/multi_json/README.md +109 -0
  74. data/vendor/multi_json/Rakefile +12 -0
  75. data/vendor/multi_json/lib/multi_json.rb +157 -0
  76. data/vendor/multi_json/lib/multi_json/adapter.rb +48 -0
  77. data/vendor/multi_json/lib/multi_json/adapters/gson.rb +19 -0
  78. data/vendor/multi_json/lib/multi_json/adapters/jr_jackson.rb +19 -0
  79. data/vendor/multi_json/lib/multi_json/adapters/json_common.rb +25 -0
  80. data/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +11 -0
  81. data/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +11 -0
  82. data/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +34 -0
  83. data/vendor/multi_json/lib/multi_json/adapters/oj.rb +24 -0
  84. data/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +22 -0
  85. data/vendor/multi_json/lib/multi_json/adapters/yajl.rb +19 -0
  86. data/vendor/multi_json/lib/multi_json/convertible_hash_keys.rb +43 -0
  87. data/vendor/multi_json/lib/multi_json/load_error.rb +11 -0
  88. data/vendor/multi_json/lib/multi_json/options.rb +48 -0
  89. data/vendor/multi_json/lib/multi_json/vendor/okjson.rb +606 -0
  90. data/vendor/multi_json/lib/multi_json/version.rb +20 -0
  91. data/vendor/multi_json/multi_json.gemspec +22 -0
  92. data/vendor/multi_json/spec/adapter_shared_example.rb +235 -0
  93. data/vendor/multi_json/spec/has_options.rb +119 -0
  94. data/vendor/multi_json/spec/helper.rb +35 -0
  95. data/vendor/multi_json/spec/json_common_shared_example.rb +30 -0
  96. data/vendor/multi_json/spec/multi_json_spec.rb +226 -0
  97. data/vendor/{signature → pusher}/.document +0 -0
  98. data/vendor/{json_pure/diagrams/.keep → pusher/.gemtest} +0 -0
  99. data/vendor/pusher/.gitignore +23 -0
  100. data/vendor/pusher/.travis.yml +15 -0
  101. data/vendor/pusher/Gemfile +2 -0
  102. data/vendor/{pusher-gem → pusher}/LICENSE +1 -1
  103. data/vendor/pusher/README.md +186 -0
  104. data/vendor/{pusher-gem → pusher}/Rakefile +0 -0
  105. data/vendor/{pusher-gem → pusher}/examples/async_message.rb +0 -0
  106. data/vendor/pusher/lib/pusher.rb +60 -0
  107. data/vendor/{pusher-gem → pusher}/lib/pusher/channel.rb +47 -54
  108. data/vendor/pusher/lib/pusher/client.rb +306 -0
  109. data/vendor/pusher/lib/pusher/request.rb +107 -0
  110. data/vendor/pusher/lib/pusher/resource.rb +36 -0
  111. data/vendor/pusher/lib/pusher/webhook.rb +110 -0
  112. data/vendor/{pusher-gem → pusher}/pusher.gemspec +6 -5
  113. data/vendor/pusher/spec/channel_spec.rb +127 -0
  114. data/vendor/pusher/spec/client_spec.rb +464 -0
  115. data/vendor/{pusher-gem → pusher}/spec/spec_helper.rb +12 -0
  116. data/vendor/pusher/spec/web_hook_spec.rb +117 -0
  117. data/vendor/signature/.travis.yml +15 -0
  118. data/vendor/signature/Gemfile +1 -1
  119. data/vendor/signature/README.md +38 -28
  120. data/vendor/signature/lib/signature.rb +97 -15
  121. data/vendor/signature/lib/signature/query_encoder.rb +47 -0
  122. data/vendor/signature/lib/signature/version.rb +1 -1
  123. data/vendor/signature/signature.gemspec +3 -2
  124. data/vendor/signature/spec/signature_spec.rb +164 -55
  125. data/vendor/signature/spec/spec_helper.rb +2 -3
  126. metadata +120 -145
  127. data/vendor/json_pure/.gitignore +0 -12
  128. data/vendor/json_pure/.travis.yml +0 -20
  129. data/vendor/json_pure/CHANGES +0 -282
  130. data/vendor/json_pure/COPYING +0 -58
  131. data/vendor/json_pure/COPYING-json-jruby +0 -57
  132. data/vendor/json_pure/GPL +0 -340
  133. data/vendor/json_pure/Gemfile +0 -11
  134. data/vendor/json_pure/README-json-jruby.markdown +0 -33
  135. data/vendor/json_pure/README.rdoc +0 -358
  136. data/vendor/json_pure/Rakefile +0 -412
  137. data/vendor/json_pure/TODO +0 -1
  138. data/vendor/json_pure/VERSION +0 -1
  139. data/vendor/json_pure/data/example.json +0 -1
  140. data/vendor/json_pure/data/index.html +0 -38
  141. data/vendor/json_pure/data/prototype.js +0 -4184
  142. data/vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h +0 -181
  143. data/vendor/json_pure/ext/json/ext/generator/depend +0 -1
  144. data/vendor/json_pure/ext/json/ext/generator/extconf.rb +0 -14
  145. data/vendor/json_pure/ext/json/ext/generator/generator.c +0 -1435
  146. data/vendor/json_pure/ext/json/ext/generator/generator.h +0 -148
  147. data/vendor/json_pure/ext/json/ext/parser/depend +0 -1
  148. data/vendor/json_pure/ext/json/ext/parser/extconf.rb +0 -13
  149. data/vendor/json_pure/ext/json/ext/parser/parser.c +0 -2204
  150. data/vendor/json_pure/ext/json/ext/parser/parser.h +0 -77
  151. data/vendor/json_pure/ext/json/ext/parser/parser.rl +0 -927
  152. data/vendor/json_pure/install.rb +0 -23
  153. data/vendor/json_pure/java/src/json/ext/ByteListTranscoder.java +0 -167
  154. data/vendor/json_pure/java/src/json/ext/Generator.java +0 -444
  155. data/vendor/json_pure/java/src/json/ext/GeneratorMethods.java +0 -232
  156. data/vendor/json_pure/java/src/json/ext/GeneratorService.java +0 -43
  157. data/vendor/json_pure/java/src/json/ext/GeneratorState.java +0 -543
  158. data/vendor/json_pure/java/src/json/ext/OptionsReader.java +0 -114
  159. data/vendor/json_pure/java/src/json/ext/Parser.java +0 -2644
  160. data/vendor/json_pure/java/src/json/ext/Parser.rl +0 -968
  161. data/vendor/json_pure/java/src/json/ext/ParserService.java +0 -35
  162. data/vendor/json_pure/java/src/json/ext/RuntimeInfo.java +0 -121
  163. data/vendor/json_pure/java/src/json/ext/StringDecoder.java +0 -167
  164. data/vendor/json_pure/java/src/json/ext/StringEncoder.java +0 -106
  165. data/vendor/json_pure/java/src/json/ext/Utils.java +0 -89
  166. data/vendor/json_pure/json-java.gemspec +0 -23
  167. data/vendor/json_pure/json.gemspec +0 -37
  168. data/vendor/json_pure/json_pure.gemspec +0 -39
  169. data/vendor/json_pure/lib/json.rb +0 -62
  170. data/vendor/json_pure/lib/json/add/bigdecimal.rb +0 -28
  171. data/vendor/json_pure/lib/json/add/complex.rb +0 -22
  172. data/vendor/json_pure/lib/json/add/core.rb +0 -11
  173. data/vendor/json_pure/lib/json/add/date.rb +0 -34
  174. data/vendor/json_pure/lib/json/add/date_time.rb +0 -50
  175. data/vendor/json_pure/lib/json/add/exception.rb +0 -31
  176. data/vendor/json_pure/lib/json/add/ostruct.rb +0 -31
  177. data/vendor/json_pure/lib/json/add/range.rb +0 -29
  178. data/vendor/json_pure/lib/json/add/rational.rb +0 -22
  179. data/vendor/json_pure/lib/json/add/regexp.rb +0 -30
  180. data/vendor/json_pure/lib/json/add/struct.rb +0 -30
  181. data/vendor/json_pure/lib/json/add/symbol.rb +0 -25
  182. data/vendor/json_pure/lib/json/add/time.rb +0 -38
  183. data/vendor/json_pure/lib/json/common.rb +0 -487
  184. data/vendor/json_pure/lib/json/ext.rb +0 -21
  185. data/vendor/json_pure/lib/json/ext/.keep +0 -0
  186. data/vendor/json_pure/lib/json/generic_object.rb +0 -70
  187. data/vendor/json_pure/lib/json/pure.rb +0 -21
  188. data/vendor/json_pure/lib/json/pure/generator.rb +0 -522
  189. data/vendor/json_pure/lib/json/pure/parser.rb +0 -359
  190. data/vendor/json_pure/lib/json/version.rb +0 -8
  191. data/vendor/json_pure/tests/fixtures/fail1.json +0 -1
  192. data/vendor/json_pure/tests/fixtures/fail10.json +0 -1
  193. data/vendor/json_pure/tests/fixtures/fail11.json +0 -1
  194. data/vendor/json_pure/tests/fixtures/fail12.json +0 -1
  195. data/vendor/json_pure/tests/fixtures/fail13.json +0 -1
  196. data/vendor/json_pure/tests/fixtures/fail14.json +0 -1
  197. data/vendor/json_pure/tests/fixtures/fail18.json +0 -1
  198. data/vendor/json_pure/tests/fixtures/fail19.json +0 -1
  199. data/vendor/json_pure/tests/fixtures/fail2.json +0 -1
  200. data/vendor/json_pure/tests/fixtures/fail20.json +0 -1
  201. data/vendor/json_pure/tests/fixtures/fail21.json +0 -1
  202. data/vendor/json_pure/tests/fixtures/fail22.json +0 -1
  203. data/vendor/json_pure/tests/fixtures/fail23.json +0 -1
  204. data/vendor/json_pure/tests/fixtures/fail24.json +0 -1
  205. data/vendor/json_pure/tests/fixtures/fail25.json +0 -1
  206. data/vendor/json_pure/tests/fixtures/fail27.json +0 -2
  207. data/vendor/json_pure/tests/fixtures/fail28.json +0 -2
  208. data/vendor/json_pure/tests/fixtures/fail3.json +0 -1
  209. data/vendor/json_pure/tests/fixtures/fail4.json +0 -1
  210. data/vendor/json_pure/tests/fixtures/fail5.json +0 -1
  211. data/vendor/json_pure/tests/fixtures/fail6.json +0 -1
  212. data/vendor/json_pure/tests/fixtures/fail7.json +0 -1
  213. data/vendor/json_pure/tests/fixtures/fail8.json +0 -1
  214. data/vendor/json_pure/tests/fixtures/fail9.json +0 -1
  215. data/vendor/json_pure/tests/fixtures/pass1.json +0 -56
  216. data/vendor/json_pure/tests/fixtures/pass15.json +0 -1
  217. data/vendor/json_pure/tests/fixtures/pass16.json +0 -1
  218. data/vendor/json_pure/tests/fixtures/pass17.json +0 -1
  219. data/vendor/json_pure/tests/fixtures/pass2.json +0 -1
  220. data/vendor/json_pure/tests/fixtures/pass26.json +0 -1
  221. data/vendor/json_pure/tests/fixtures/pass3.json +0 -6
  222. data/vendor/json_pure/tests/setup_variant.rb +0 -11
  223. data/vendor/json_pure/tests/test_json.rb +0 -545
  224. data/vendor/json_pure/tests/test_json_addition.rb +0 -196
  225. data/vendor/json_pure/tests/test_json_encoding.rb +0 -65
  226. data/vendor/json_pure/tests/test_json_fixtures.rb +0 -35
  227. data/vendor/json_pure/tests/test_json_generate.rb +0 -322
  228. data/vendor/json_pure/tests/test_json_generic_object.rb +0 -75
  229. data/vendor/json_pure/tests/test_json_string_matching.rb +0 -39
  230. data/vendor/json_pure/tests/test_json_unicode.rb +0 -72
  231. data/vendor/json_pure/tools/fuzz.rb +0 -139
  232. data/vendor/json_pure/tools/server.rb +0 -62
  233. data/vendor/pusher-gem/Gemfile +0 -2
  234. data/vendor/pusher-gem/README.md +0 -80
  235. data/vendor/pusher-gem/lib/pusher.rb +0 -107
  236. data/vendor/pusher-gem/lib/pusher/request.rb +0 -107
  237. data/vendor/pusher-gem/spec/channel_spec.rb +0 -274
  238. data/vendor/pusher-gem/spec/pusher_spec.rb +0 -87
  239. data/vendor/ruby-hmac/History.txt +0 -15
  240. data/vendor/ruby-hmac/Manifest.txt +0 -11
  241. data/vendor/ruby-hmac/README.md +0 -41
  242. data/vendor/ruby-hmac/Rakefile +0 -23
  243. data/vendor/ruby-hmac/lib/hmac-md5.rb +0 -11
  244. data/vendor/ruby-hmac/lib/hmac-rmd160.rb +0 -11
  245. data/vendor/ruby-hmac/lib/hmac-sha1.rb +0 -11
  246. data/vendor/ruby-hmac/lib/hmac-sha2.rb +0 -25
  247. data/vendor/ruby-hmac/lib/hmac.rb +0 -118
  248. data/vendor/ruby-hmac/lib/ruby_hmac.rb +0 -2
  249. data/vendor/ruby-hmac/ruby-hmac.gemspec +0 -33
  250. data/vendor/ruby-hmac/test/test_hmac.rb +0 -89
  251. data/vendor/signature/VERSION +0 -1
@@ -1,359 +0,0 @@
1
- require 'strscan'
2
-
3
- module JSON
4
- module Pure
5
- # This class implements the JSON parser that is used to parse a JSON string
6
- # into a Ruby data structure.
7
- class Parser < StringScanner
8
- STRING = /" ((?:[^\x0-\x1f"\\] |
9
- # escaped special characters:
10
- \\["\\\/bfnrt] |
11
- \\u[0-9a-fA-F]{4} |
12
- # match all but escaped special characters:
13
- \\[\x20-\x21\x23-\x2e\x30-\x5b\x5d-\x61\x63-\x65\x67-\x6d\x6f-\x71\x73\x75-\xff])*)
14
- "/nx
15
- INTEGER = /(-?0|-?[1-9]\d*)/
16
- FLOAT = /(-?
17
- (?:0|[1-9]\d*)
18
- (?:
19
- \.\d+(?i:e[+-]?\d+) |
20
- \.\d+ |
21
- (?i:e[+-]?\d+)
22
- )
23
- )/x
24
- NAN = /NaN/
25
- INFINITY = /Infinity/
26
- MINUS_INFINITY = /-Infinity/
27
- OBJECT_OPEN = /\{/
28
- OBJECT_CLOSE = /\}/
29
- ARRAY_OPEN = /\[/
30
- ARRAY_CLOSE = /\]/
31
- PAIR_DELIMITER = /:/
32
- COLLECTION_DELIMITER = /,/
33
- TRUE = /true/
34
- FALSE = /false/
35
- NULL = /null/
36
- IGNORE = %r(
37
- (?:
38
- //[^\n\r]*[\n\r]| # line comments
39
- /\* # c-style comments
40
- (?:
41
- [^*/]| # normal chars
42
- /[^*]| # slashes that do not start a nested comment
43
- \*[^/]| # asterisks that do not end this comment
44
- /(?=\*/) # single slash before this comment's end
45
- )*
46
- \*/ # the End of this comment
47
- |[ \t\r\n]+ # whitespaces: space, horicontal tab, lf, cr
48
- )+
49
- )mx
50
-
51
- UNPARSED = Object.new
52
-
53
- # Creates a new JSON::Pure::Parser instance for the string _source_.
54
- #
55
- # It will be configured by the _opts_ hash. _opts_ can have the following
56
- # keys:
57
- # * *max_nesting*: The maximum depth of nesting allowed in the parsed data
58
- # structures. Disable depth checking with :max_nesting => false|nil|0,
59
- # it defaults to 100.
60
- # * *allow_nan*: If set to true, allow NaN, Infinity and -Infinity in
61
- # defiance of RFC 4627 to be parsed by the Parser. This option defaults
62
- # to false.
63
- # * *symbolize_names*: If set to true, returns symbols for the names
64
- # (keys) in a JSON object. Otherwise strings are returned, which is also
65
- # the default.
66
- # * *create_additions*: If set to true, the Parser creates
67
- # additions when if a matching class and create_id was found. This
68
- # option defaults to false.
69
- # * *object_class*: Defaults to Hash
70
- # * *array_class*: Defaults to Array
71
- # * *quirks_mode*: Enables quirks_mode for parser, that is for example
72
- # parsing single JSON values instead of documents is possible.
73
- def initialize(source, opts = {})
74
- opts ||= {}
75
- unless @quirks_mode = opts[:quirks_mode]
76
- source = convert_encoding source
77
- end
78
- super source
79
- if !opts.key?(:max_nesting) # defaults to 100
80
- @max_nesting = 100
81
- elsif opts[:max_nesting]
82
- @max_nesting = opts[:max_nesting]
83
- else
84
- @max_nesting = 0
85
- end
86
- @allow_nan = !!opts[:allow_nan]
87
- @symbolize_names = !!opts[:symbolize_names]
88
- if opts.key?(:create_additions)
89
- @create_additions = !!opts[:create_additions]
90
- else
91
- @create_additions = false
92
- end
93
- @create_id = @create_additions ? JSON.create_id : nil
94
- @object_class = opts[:object_class] || Hash
95
- @array_class = opts[:array_class] || Array
96
- @match_string = opts[:match_string]
97
- end
98
-
99
- alias source string
100
-
101
- def quirks_mode?
102
- !!@quirks_mode
103
- end
104
-
105
- def reset
106
- super
107
- @current_nesting = 0
108
- end
109
-
110
- # Parses the current JSON string _source_ and returns the complete data
111
- # structure as a result.
112
- def parse
113
- reset
114
- obj = nil
115
- if @quirks_mode
116
- while !eos? && skip(IGNORE)
117
- end
118
- if eos?
119
- raise ParserError, "source did not contain any JSON!"
120
- else
121
- obj = parse_value
122
- obj == UNPARSED and raise ParserError, "source did not contain any JSON!"
123
- end
124
- else
125
- until eos?
126
- case
127
- when scan(OBJECT_OPEN)
128
- obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
129
- @current_nesting = 1
130
- obj = parse_object
131
- when scan(ARRAY_OPEN)
132
- obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
133
- @current_nesting = 1
134
- obj = parse_array
135
- when skip(IGNORE)
136
- ;
137
- else
138
- raise ParserError, "source '#{peek(20)}' not in JSON!"
139
- end
140
- end
141
- obj or raise ParserError, "source did not contain any JSON!"
142
- end
143
- obj
144
- end
145
-
146
- private
147
-
148
- def convert_encoding(source)
149
- if source.respond_to?(:to_str)
150
- source = source.to_str
151
- else
152
- raise TypeError, "#{source.inspect} is not like a string"
153
- end
154
- if defined?(::Encoding)
155
- if source.encoding == ::Encoding::ASCII_8BIT
156
- b = source[0, 4].bytes.to_a
157
- source =
158
- case
159
- when b.size >= 4 && b[0] == 0 && b[1] == 0 && b[2] == 0
160
- source.dup.force_encoding(::Encoding::UTF_32BE).encode!(::Encoding::UTF_8)
161
- when b.size >= 4 && b[0] == 0 && b[2] == 0
162
- source.dup.force_encoding(::Encoding::UTF_16BE).encode!(::Encoding::UTF_8)
163
- when b.size >= 4 && b[1] == 0 && b[2] == 0 && b[3] == 0
164
- source.dup.force_encoding(::Encoding::UTF_32LE).encode!(::Encoding::UTF_8)
165
- when b.size >= 4 && b[1] == 0 && b[3] == 0
166
- source.dup.force_encoding(::Encoding::UTF_16LE).encode!(::Encoding::UTF_8)
167
- else
168
- source.dup
169
- end
170
- else
171
- source = source.encode(::Encoding::UTF_8)
172
- end
173
- source.force_encoding(::Encoding::ASCII_8BIT)
174
- else
175
- b = source
176
- source =
177
- case
178
- when b.size >= 4 && b[0] == 0 && b[1] == 0 && b[2] == 0
179
- JSON.iconv('utf-8', 'utf-32be', b)
180
- when b.size >= 4 && b[0] == 0 && b[2] == 0
181
- JSON.iconv('utf-8', 'utf-16be', b)
182
- when b.size >= 4 && b[1] == 0 && b[2] == 0 && b[3] == 0
183
- JSON.iconv('utf-8', 'utf-32le', b)
184
- when b.size >= 4 && b[1] == 0 && b[3] == 0
185
- JSON.iconv('utf-8', 'utf-16le', b)
186
- else
187
- b
188
- end
189
- end
190
- source
191
- end
192
-
193
- # Unescape characters in strings.
194
- UNESCAPE_MAP = Hash.new { |h, k| h[k] = k.chr }
195
- UNESCAPE_MAP.update({
196
- ?" => '"',
197
- ?\\ => '\\',
198
- ?/ => '/',
199
- ?b => "\b",
200
- ?f => "\f",
201
- ?n => "\n",
202
- ?r => "\r",
203
- ?t => "\t",
204
- ?u => nil,
205
- })
206
-
207
- EMPTY_8BIT_STRING = ''
208
- if ::String.method_defined?(:encode)
209
- EMPTY_8BIT_STRING.force_encoding Encoding::ASCII_8BIT
210
- end
211
-
212
- def parse_string
213
- if scan(STRING)
214
- return '' if self[1].empty?
215
- string = self[1].gsub(%r((?:\\[\\bfnrt"/]|(?:\\u(?:[A-Fa-f\d]{4}))+|\\[\x20-\xff]))n) do |c|
216
- if u = UNESCAPE_MAP[$&[1]]
217
- u
218
- else # \uXXXX
219
- bytes = EMPTY_8BIT_STRING.dup
220
- i = 0
221
- while c[6 * i] == ?\\ && c[6 * i + 1] == ?u
222
- bytes << c[6 * i + 2, 2].to_i(16) << c[6 * i + 4, 2].to_i(16)
223
- i += 1
224
- end
225
- JSON.iconv('utf-8', 'utf-16be', bytes)
226
- end
227
- end
228
- if string.respond_to?(:force_encoding)
229
- string.force_encoding(::Encoding::UTF_8)
230
- end
231
- if @create_additions and @match_string
232
- for (regexp, klass) in @match_string
233
- klass.json_creatable? or next
234
- string =~ regexp and return klass.json_create(string)
235
- end
236
- end
237
- string
238
- else
239
- UNPARSED
240
- end
241
- rescue => e
242
- raise ParserError, "Caught #{e.class} at '#{peek(20)}': #{e}"
243
- end
244
-
245
- def parse_value
246
- case
247
- when scan(FLOAT)
248
- Float(self[1])
249
- when scan(INTEGER)
250
- Integer(self[1])
251
- when scan(TRUE)
252
- true
253
- when scan(FALSE)
254
- false
255
- when scan(NULL)
256
- nil
257
- when (string = parse_string) != UNPARSED
258
- string
259
- when scan(ARRAY_OPEN)
260
- @current_nesting += 1
261
- ary = parse_array
262
- @current_nesting -= 1
263
- ary
264
- when scan(OBJECT_OPEN)
265
- @current_nesting += 1
266
- obj = parse_object
267
- @current_nesting -= 1
268
- obj
269
- when @allow_nan && scan(NAN)
270
- NaN
271
- when @allow_nan && scan(INFINITY)
272
- Infinity
273
- when @allow_nan && scan(MINUS_INFINITY)
274
- MinusInfinity
275
- else
276
- UNPARSED
277
- end
278
- end
279
-
280
- def parse_array
281
- raise NestingError, "nesting of #@current_nesting is too deep" if
282
- @max_nesting.nonzero? && @current_nesting > @max_nesting
283
- result = @array_class.new
284
- delim = false
285
- until eos?
286
- case
287
- when (value = parse_value) != UNPARSED
288
- delim = false
289
- result << value
290
- skip(IGNORE)
291
- if scan(COLLECTION_DELIMITER)
292
- delim = true
293
- elsif match?(ARRAY_CLOSE)
294
- ;
295
- else
296
- raise ParserError, "expected ',' or ']' in array at '#{peek(20)}'!"
297
- end
298
- when scan(ARRAY_CLOSE)
299
- if delim
300
- raise ParserError, "expected next element in array at '#{peek(20)}'!"
301
- end
302
- break
303
- when skip(IGNORE)
304
- ;
305
- else
306
- raise ParserError, "unexpected token in array at '#{peek(20)}'!"
307
- end
308
- end
309
- result
310
- end
311
-
312
- def parse_object
313
- raise NestingError, "nesting of #@current_nesting is too deep" if
314
- @max_nesting.nonzero? && @current_nesting > @max_nesting
315
- result = @object_class.new
316
- delim = false
317
- until eos?
318
- case
319
- when (string = parse_string) != UNPARSED
320
- skip(IGNORE)
321
- unless scan(PAIR_DELIMITER)
322
- raise ParserError, "expected ':' in object at '#{peek(20)}'!"
323
- end
324
- skip(IGNORE)
325
- unless (value = parse_value).equal? UNPARSED
326
- result[@symbolize_names ? string.to_sym : string] = value
327
- delim = false
328
- skip(IGNORE)
329
- if scan(COLLECTION_DELIMITER)
330
- delim = true
331
- elsif match?(OBJECT_CLOSE)
332
- ;
333
- else
334
- raise ParserError, "expected ',' or '}' in object at '#{peek(20)}'!"
335
- end
336
- else
337
- raise ParserError, "expected value in object at '#{peek(20)}'!"
338
- end
339
- when scan(OBJECT_CLOSE)
340
- if delim
341
- raise ParserError, "expected next name, value pair in object at '#{peek(20)}'!"
342
- end
343
- if @create_additions and klassname = result[@create_id]
344
- klass = JSON.deep_const_get klassname
345
- break unless klass and klass.json_creatable?
346
- result = klass.json_create(result)
347
- end
348
- break
349
- when skip(IGNORE)
350
- ;
351
- else
352
- raise ParserError, "unexpected token in object at '#{peek(20)}'!"
353
- end
354
- end
355
- result
356
- end
357
- end
358
- end
359
- end
@@ -1,8 +0,0 @@
1
- module JSON
2
- # JSON version
3
- VERSION = '1.8.0'
4
- VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
7
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
8
- end
@@ -1 +0,0 @@
1
- "A JSON payload should be an object or array, not a string."
@@ -1 +0,0 @@
1
- {"Extra value after close": true} "misplaced quoted value"
@@ -1 +0,0 @@
1
- {"Illegal expression": 1 + 2}
@@ -1 +0,0 @@
1
- {"Illegal invocation": alert()}
@@ -1 +0,0 @@
1
- {"Numbers cannot have leading zeroes": 013}
@@ -1 +0,0 @@
1
- {"Numbers cannot be hex": 0x14}
@@ -1 +0,0 @@
1
- [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
@@ -1 +0,0 @@
1
- {"Missing colon" null}
@@ -1 +0,0 @@
1
- ["Unclosed array"
@@ -1 +0,0 @@
1
- {"Double colon":: null}
@@ -1 +0,0 @@
1
- {"Comma instead of colon", null}
@@ -1 +0,0 @@
1
- ["Colon instead of comma": false]
@@ -1 +0,0 @@
1
- ["Bad value", truth]
@@ -1 +0,0 @@
1
- ['single quote']
@@ -1 +0,0 @@
1
- ["tab character in string "]
@@ -1,2 +0,0 @@
1
- ["line
2
- break"]
@@ -1,2 +0,0 @@
1
- ["line\
2
- break"]
@@ -1 +0,0 @@
1
- {unquoted_key: "keys must be quoted"}
@@ -1 +0,0 @@
1
- ["extra comma",]
@@ -1 +0,0 @@
1
- ["double extra comma",,]
@@ -1 +0,0 @@
1
- [ , "<-- missing value"]
@@ -1 +0,0 @@
1
- ["Comma after the close"],
@@ -1 +0,0 @@
1
- ["Extra close"]]
@@ -1 +0,0 @@
1
- {"Extra comma": true,}