json2-rails 0.0.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f5a97bc5d41a1ec3a4b408efa1164ab801af710
|
|
4
|
+
data.tar.gz: d0b3628e778bff7d6754a289cff83a62a952e089
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb015ecb8ea3de9002d977fe32de57423a000b34a9cd9848d596e6e37aa40250352fca4c8b5b1832b11bb977bb3b65a4de86fdf9556eccdf7a6351099d749853
|
|
7
|
+
data.tar.gz: 30d93bdab33c91e82e29bcde4dcb07002b9a50dd931f1c7df576036b793d44992aaf1f6f636b942331de93dab3257d24e69ac952b0859c5ee10b65d5d608665e
|
data/lib/json2-rails/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
json.js
|
|
3
|
-
|
|
3
|
+
2013-05-26
|
|
4
4
|
|
|
5
5
|
Public Domain
|
|
6
6
|
|
|
@@ -212,13 +212,14 @@ if (typeof JSON !== 'object') {
|
|
|
212
212
|
|
|
213
213
|
Date.prototype.toJSON = function (key) {
|
|
214
214
|
|
|
215
|
-
return isFinite(this.valueOf())
|
|
216
|
-
this.getUTCFullYear()
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
215
|
+
return isFinite(this.valueOf())
|
|
216
|
+
? this.getUTCFullYear() + '-' +
|
|
217
|
+
f(this.getUTCMonth() + 1) + '-' +
|
|
218
|
+
f(this.getUTCDate()) + 'T' +
|
|
219
|
+
f(this.getUTCHours()) + ':' +
|
|
220
|
+
f(this.getUTCMinutes()) + ':' +
|
|
221
|
+
f(this.getUTCSeconds()) + 'Z'
|
|
222
|
+
: null;
|
|
222
223
|
};
|
|
223
224
|
|
|
224
225
|
String.prototype.toJSON =
|
|
@@ -254,8 +255,9 @@ if (typeof JSON !== 'object') {
|
|
|
254
255
|
escapable.lastIndex = 0;
|
|
255
256
|
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
|
256
257
|
var c = meta[a];
|
|
257
|
-
return typeof c === 'string'
|
|
258
|
-
|
|
258
|
+
return typeof c === 'string'
|
|
259
|
+
? c
|
|
260
|
+
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
|
259
261
|
}) + '"' : '"' + string + '"';
|
|
260
262
|
}
|
|
261
263
|
|
|
@@ -339,9 +341,11 @@ if (typeof JSON !== 'object') {
|
|
|
339
341
|
// Join all of the elements together, separated with commas, and wrap them in
|
|
340
342
|
// brackets.
|
|
341
343
|
|
|
342
|
-
v = partial.length === 0
|
|
343
|
-
'[
|
|
344
|
-
|
|
344
|
+
v = partial.length === 0
|
|
345
|
+
? '[]'
|
|
346
|
+
: gap
|
|
347
|
+
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
|
348
|
+
: '[' + partial.join(',') + ']';
|
|
345
349
|
gap = mind;
|
|
346
350
|
return v;
|
|
347
351
|
}
|
|
@@ -376,9 +380,10 @@ if (typeof JSON !== 'object') {
|
|
|
376
380
|
// Join all of the member texts together, separated with commas,
|
|
377
381
|
// and wrap them in braces.
|
|
378
382
|
|
|
379
|
-
v = partial.length === 0 ? '{}'
|
|
380
|
-
|
|
381
|
-
'{' + partial.join('
|
|
383
|
+
v = partial.length === 0 ? '{}'
|
|
384
|
+
: gap
|
|
385
|
+
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
|
386
|
+
: '{' + partial.join(',') + '}';
|
|
382
387
|
gap = mind;
|
|
383
388
|
return v;
|
|
384
389
|
}
|
|
@@ -504,8 +509,9 @@ if (typeof JSON !== 'object') {
|
|
|
504
509
|
// In the optional fourth stage, we recursively walk the new structure, passing
|
|
505
510
|
// each name/value pair to a reviver function for possible transformation.
|
|
506
511
|
|
|
507
|
-
return typeof reviver === 'function'
|
|
508
|
-
walk({'': j}, '')
|
|
512
|
+
return typeof reviver === 'function'
|
|
513
|
+
? walk({'': j}, '')
|
|
514
|
+
: j;
|
|
509
515
|
}
|
|
510
516
|
|
|
511
517
|
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
json2.js
|
|
3
|
-
|
|
3
|
+
2013-05-26
|
|
4
4
|
|
|
5
5
|
Public Domain.
|
|
6
6
|
|
|
@@ -173,7 +173,7 @@ if (typeof JSON !== 'object') {
|
|
|
173
173
|
|
|
174
174
|
if (typeof Date.prototype.toJSON !== 'function') {
|
|
175
175
|
|
|
176
|
-
Date.prototype.toJSON = function (
|
|
176
|
+
Date.prototype.toJSON = function () {
|
|
177
177
|
|
|
178
178
|
return isFinite(this.valueOf())
|
|
179
179
|
? this.getUTCFullYear() + '-' +
|
|
@@ -187,7 +187,7 @@ if (typeof JSON !== 'object') {
|
|
|
187
187
|
|
|
188
188
|
String.prototype.toJSON =
|
|
189
189
|
Number.prototype.toJSON =
|
|
190
|
-
Boolean.prototype.toJSON = function (
|
|
190
|
+
Boolean.prototype.toJSON = function () {
|
|
191
191
|
return this.valueOf();
|
|
192
192
|
};
|
|
193
193
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
json_parse_state.js
|
|
3
|
-
|
|
3
|
+
2013-05-26
|
|
4
4
|
|
|
5
5
|
Public Domain.
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
NOT CONTROL.
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
-
/*jslint regexp:
|
|
49
|
+
/*jslint regexp: true, unparam: true */
|
|
50
50
|
|
|
51
51
|
/*members "", "\"", ",", "\/", ":", "[", "\\", "]", acomma, avalue, b,
|
|
52
52
|
call, colon, container, exec, f, false, firstavalue, firstokey,
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: json2-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maksim Berjoza
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-06-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: ''
|
|
14
14
|
email:
|
|
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
46
46
|
version: '0'
|
|
47
47
|
requirements: []
|
|
48
48
|
rubyforge_project:
|
|
49
|
-
rubygems_version: 2.0.
|
|
49
|
+
rubygems_version: 2.0.3
|
|
50
50
|
signing_key:
|
|
51
51
|
specification_version: 4
|
|
52
52
|
summary: Crockford's json2, json with Rails asset pipeline
|