engineyard-serverside 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. data/lib/engineyard-serverside.rb +3 -3
  2. data/lib/engineyard-serverside/configuration.rb +6 -6
  3. data/lib/engineyard-serverside/deploy.rb +11 -7
  4. data/lib/engineyard-serverside/version.rb +1 -1
  5. data/lib/vendor/multi_json/CHANGELOG.md +121 -0
  6. data/lib/vendor/multi_json/CONTRIBUTING.md +46 -0
  7. data/lib/vendor/multi_json/Gemfile +31 -0
  8. data/lib/vendor/multi_json/LICENSE.md +20 -0
  9. data/lib/vendor/multi_json/README.md +105 -0
  10. data/lib/vendor/multi_json/Rakefile +12 -0
  11. data/lib/vendor/multi_json/lib/multi_json.rb +137 -0
  12. data/lib/vendor/multi_json/lib/multi_json/adapters/gson.rb +20 -0
  13. data/lib/vendor/multi_json/lib/multi_json/adapters/json_common.rb +35 -0
  14. data/lib/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +12 -0
  15. data/lib/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +12 -0
  16. data/lib/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +35 -0
  17. data/lib/vendor/multi_json/lib/multi_json/adapters/oj.rb +29 -0
  18. data/lib/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +58 -0
  19. data/lib/vendor/multi_json/lib/multi_json/adapters/yajl.rb +20 -0
  20. data/lib/vendor/multi_json/lib/multi_json/vendor/okjson.rb +602 -0
  21. data/lib/vendor/multi_json/lib/multi_json/version.rb +3 -0
  22. data/lib/vendor/multi_json/multi_json.gemspec +22 -0
  23. data/lib/vendor/multi_json/spec/adapter_shared_example.rb +162 -0
  24. data/lib/vendor/multi_json/spec/helper.rb +45 -0
  25. data/lib/vendor/multi_json/spec/json_common_shared_example.rb +36 -0
  26. data/lib/vendor/multi_json/spec/multi_json_spec.rb +151 -0
  27. data/spec/configuration_spec.rb +79 -1
  28. data/spec/deploy_hook_spec.rb +2 -2
  29. data/spec/spec_helper.rb +1 -1
  30. metadata +26 -120
  31. data/lib/vendor/json_pure/CHANGES +0 -166
  32. data/lib/vendor/json_pure/COPYING +0 -58
  33. data/lib/vendor/json_pure/GPL +0 -340
  34. data/lib/vendor/json_pure/README +0 -358
  35. data/lib/vendor/json_pure/Rakefile +0 -292
  36. data/lib/vendor/json_pure/TODO +0 -1
  37. data/lib/vendor/json_pure/VERSION +0 -1
  38. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +0 -52
  39. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +0 -1000
  40. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +0 -1001
  41. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +0 -900
  42. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +0 -901
  43. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +0 -1000
  44. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +0 -1001
  45. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +0 -261
  46. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +0 -1000
  47. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +0 -1001
  48. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +0 -1000
  49. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +0 -1001
  50. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +0 -1000
  51. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +0 -1001
  52. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +0 -262
  53. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +0 -1000
  54. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +0 -1001
  55. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +0 -82
  56. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +0 -34
  57. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +0 -900
  58. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +0 -901
  59. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +0 -81
  60. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +0 -1000
  61. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +0 -1001
  62. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +0 -82
  63. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +0 -1000
  64. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +0 -1001
  65. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +0 -82
  66. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +0 -1000
  67. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +0 -1001
  68. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +0 -82
  69. data/lib/vendor/json_pure/benchmarks/generator2_benchmark.rb +0 -222
  70. data/lib/vendor/json_pure/benchmarks/generator_benchmark.rb +0 -224
  71. data/lib/vendor/json_pure/benchmarks/ohai.json +0 -1216
  72. data/lib/vendor/json_pure/benchmarks/ohai.ruby +0 -1
  73. data/lib/vendor/json_pure/benchmarks/parser2_benchmark.rb +0 -251
  74. data/lib/vendor/json_pure/benchmarks/parser_benchmark.rb +0 -259
  75. data/lib/vendor/json_pure/bin/edit_json.rb +0 -9
  76. data/lib/vendor/json_pure/bin/prettify_json.rb +0 -75
  77. data/lib/vendor/json_pure/data/example.json +0 -1
  78. data/lib/vendor/json_pure/data/index.html +0 -38
  79. data/lib/vendor/json_pure/data/prototype.js +0 -4184
  80. data/lib/vendor/json_pure/ext/json/ext/generator/extconf.rb +0 -16
  81. data/lib/vendor/json_pure/ext/json/ext/generator/generator.c +0 -1323
  82. data/lib/vendor/json_pure/ext/json/ext/generator/generator.h +0 -170
  83. data/lib/vendor/json_pure/ext/json/ext/parser/extconf.rb +0 -15
  84. data/lib/vendor/json_pure/ext/json/ext/parser/parser.c +0 -1935
  85. data/lib/vendor/json_pure/ext/json/ext/parser/parser.h +0 -71
  86. data/lib/vendor/json_pure/ext/json/ext/parser/parser.rl +0 -792
  87. data/lib/vendor/json_pure/install.rb +0 -26
  88. data/lib/vendor/json_pure/lib/json.rb +0 -10
  89. data/lib/vendor/json_pure/lib/json/Array.xpm +0 -21
  90. data/lib/vendor/json_pure/lib/json/FalseClass.xpm +0 -21
  91. data/lib/vendor/json_pure/lib/json/Hash.xpm +0 -21
  92. data/lib/vendor/json_pure/lib/json/Key.xpm +0 -73
  93. data/lib/vendor/json_pure/lib/json/NilClass.xpm +0 -21
  94. data/lib/vendor/json_pure/lib/json/Numeric.xpm +0 -28
  95. data/lib/vendor/json_pure/lib/json/String.xpm +0 -96
  96. data/lib/vendor/json_pure/lib/json/TrueClass.xpm +0 -21
  97. data/lib/vendor/json_pure/lib/json/add/core.rb +0 -148
  98. data/lib/vendor/json_pure/lib/json/add/rails.rb +0 -58
  99. data/lib/vendor/json_pure/lib/json/common.rb +0 -397
  100. data/lib/vendor/json_pure/lib/json/editor.rb +0 -1371
  101. data/lib/vendor/json_pure/lib/json/ext.rb +0 -15
  102. data/lib/vendor/json_pure/lib/json/json.xpm +0 -1499
  103. data/lib/vendor/json_pure/lib/json/pure.rb +0 -77
  104. data/lib/vendor/json_pure/lib/json/pure/generator.rb +0 -452
  105. data/lib/vendor/json_pure/lib/json/pure/parser.rb +0 -307
  106. data/lib/vendor/json_pure/lib/json/version.rb +0 -8
  107. data/lib/vendor/json_pure/tests/fixtures/fail1.json +0 -1
  108. data/lib/vendor/json_pure/tests/fixtures/fail10.json +0 -1
  109. data/lib/vendor/json_pure/tests/fixtures/fail11.json +0 -1
  110. data/lib/vendor/json_pure/tests/fixtures/fail12.json +0 -1
  111. data/lib/vendor/json_pure/tests/fixtures/fail13.json +0 -1
  112. data/lib/vendor/json_pure/tests/fixtures/fail14.json +0 -1
  113. data/lib/vendor/json_pure/tests/fixtures/fail18.json +0 -1
  114. data/lib/vendor/json_pure/tests/fixtures/fail19.json +0 -1
  115. data/lib/vendor/json_pure/tests/fixtures/fail2.json +0 -1
  116. data/lib/vendor/json_pure/tests/fixtures/fail20.json +0 -1
  117. data/lib/vendor/json_pure/tests/fixtures/fail21.json +0 -1
  118. data/lib/vendor/json_pure/tests/fixtures/fail22.json +0 -1
  119. data/lib/vendor/json_pure/tests/fixtures/fail23.json +0 -1
  120. data/lib/vendor/json_pure/tests/fixtures/fail24.json +0 -1
  121. data/lib/vendor/json_pure/tests/fixtures/fail25.json +0 -1
  122. data/lib/vendor/json_pure/tests/fixtures/fail27.json +0 -2
  123. data/lib/vendor/json_pure/tests/fixtures/fail28.json +0 -2
  124. data/lib/vendor/json_pure/tests/fixtures/fail3.json +0 -1
  125. data/lib/vendor/json_pure/tests/fixtures/fail4.json +0 -1
  126. data/lib/vendor/json_pure/tests/fixtures/fail5.json +0 -1
  127. data/lib/vendor/json_pure/tests/fixtures/fail6.json +0 -1
  128. data/lib/vendor/json_pure/tests/fixtures/fail7.json +0 -1
  129. data/lib/vendor/json_pure/tests/fixtures/fail8.json +0 -1
  130. data/lib/vendor/json_pure/tests/fixtures/fail9.json +0 -1
  131. data/lib/vendor/json_pure/tests/fixtures/pass1.json +0 -56
  132. data/lib/vendor/json_pure/tests/fixtures/pass15.json +0 -1
  133. data/lib/vendor/json_pure/tests/fixtures/pass16.json +0 -1
  134. data/lib/vendor/json_pure/tests/fixtures/pass17.json +0 -1
  135. data/lib/vendor/json_pure/tests/fixtures/pass2.json +0 -1
  136. data/lib/vendor/json_pure/tests/fixtures/pass26.json +0 -1
  137. data/lib/vendor/json_pure/tests/fixtures/pass3.json +0 -6
  138. data/lib/vendor/json_pure/tests/test_json.rb +0 -361
  139. data/lib/vendor/json_pure/tests/test_json_addition.rb +0 -162
  140. data/lib/vendor/json_pure/tests/test_json_encoding.rb +0 -68
  141. data/lib/vendor/json_pure/tests/test_json_fixtures.rb +0 -34
  142. data/lib/vendor/json_pure/tests/test_json_generate.rb +0 -122
  143. data/lib/vendor/json_pure/tests/test_json_rails.rb +0 -144
  144. data/lib/vendor/json_pure/tests/test_json_unicode.rb +0 -76
  145. data/lib/vendor/json_pure/tools/fuzz.rb +0 -139
  146. data/lib/vendor/json_pure/tools/server.rb +0 -61
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rbconfig'
4
- require 'fileutils'
5
- include FileUtils::Verbose
6
-
7
- include Config
8
-
9
- bindir = CONFIG["bindir"]
10
- cd 'bin' do
11
- filename = 'edit_json.rb'
12
- #install(filename, bindir)
13
- end
14
- sitelibdir = CONFIG["sitelibdir"]
15
- cd 'lib' do
16
- install('json.rb', sitelibdir)
17
- mkdir_p File.join(sitelibdir, 'json')
18
- for file in Dir['json/**/*.{rb,xpm}']
19
- d = File.join(sitelibdir, file)
20
- mkdir_p File.dirname(d)
21
- install(file, d)
22
- end
23
- install(File.join('json', 'editor.rb'), File.join(sitelibdir,'json'))
24
- install(File.join('json', 'json.xpm'), File.join(sitelibdir,'json'))
25
- end
26
- warn " *** Installed PURE ruby library."
@@ -1,10 +0,0 @@
1
- require 'json/common'
2
- module JSON
3
- require 'json/version'
4
-
5
- begin
6
- require 'json/ext'
7
- rescue LoadError
8
- require 'json/pure'
9
- end
10
- end
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * Array_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #000000",
6
- " ",
7
- " ",
8
- " ",
9
- " .......... ",
10
- " . . ",
11
- " . . ",
12
- " . . ",
13
- " . . ",
14
- " . . ",
15
- " . . ",
16
- " . . ",
17
- " . . ",
18
- " .......... ",
19
- " ",
20
- " ",
21
- " "};
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * False_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #FF0000",
6
- " ",
7
- " ",
8
- " ",
9
- " ...... ",
10
- " . ",
11
- " . ",
12
- " . ",
13
- " ...... ",
14
- " . ",
15
- " . ",
16
- " . ",
17
- " . ",
18
- " . ",
19
- " ",
20
- " ",
21
- " "};
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * Hash_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #000000",
6
- " ",
7
- " ",
8
- " ",
9
- " . . ",
10
- " . . ",
11
- " . . ",
12
- " ......... ",
13
- " . . ",
14
- " . . ",
15
- " ......... ",
16
- " . . ",
17
- " . . ",
18
- " . . ",
19
- " ",
20
- " ",
21
- " "};
@@ -1,73 +0,0 @@
1
- /* XPM */
2
- static char * Key_xpm[] = {
3
- "16 16 54 1",
4
- " c None",
5
- ". c #110007",
6
- "+ c #0E0900",
7
- "@ c #000013",
8
- "# c #070600",
9
- "$ c #F6F006",
10
- "% c #ECE711",
11
- "& c #E5EE00",
12
- "* c #16021E",
13
- "= c #120900",
14
- "- c #EDF12B",
15
- "; c #000033",
16
- "> c #0F0000",
17
- ", c #FFFE03",
18
- "' c #E6E500",
19
- ") c #16021B",
20
- "! c #F7F502",
21
- "~ c #000E00",
22
- "{ c #130000",
23
- "] c #FFF000",
24
- "^ c #FFE711",
25
- "/ c #140005",
26
- "( c #190025",
27
- "_ c #E9DD27",
28
- ": c #E7DC04",
29
- "< c #FFEC09",
30
- "[ c #FFE707",
31
- "} c #FFDE10",
32
- "| c #150021",
33
- "1 c #160700",
34
- "2 c #FAF60E",
35
- "3 c #EFE301",
36
- "4 c #FEF300",
37
- "5 c #E7E000",
38
- "6 c #FFFF08",
39
- "7 c #0E0206",
40
- "8 c #040000",
41
- "9 c #03052E",
42
- "0 c #041212",
43
- "a c #070300",
44
- "b c #F2E713",
45
- "c c #F9DE13",
46
- "d c #36091E",
47
- "e c #00001C",
48
- "f c #1F0010",
49
- "g c #FFF500",
50
- "h c #DEDE00",
51
- "i c #050A00",
52
- "j c #FAF14A",
53
- "k c #F5F200",
54
- "l c #040404",
55
- "m c #1A0D00",
56
- "n c #EDE43D",
57
- "o c #ECE007",
58
- " ",
59
- " ",
60
- " .+@ ",
61
- " #$%&* ",
62
- " =-;>,') ",
63
- " >!~{]^/ ",
64
- " (_:<[}| ",
65
- " 1234567 ",
66
- " 890abcd ",
67
- " efghi ",
68
- " >jkl ",
69
- " mnol ",
70
- " >kl ",
71
- " ll ",
72
- " ",
73
- " "};
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * False_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #000000",
6
- " ",
7
- " ",
8
- " ",
9
- " ... ",
10
- " . . ",
11
- " . . ",
12
- " . . ",
13
- " . . ",
14
- " . . ",
15
- " . . ",
16
- " . . ",
17
- " . . ",
18
- " ... ",
19
- " ",
20
- " ",
21
- " "};
@@ -1,28 +0,0 @@
1
- /* XPM */
2
- static char * Numeric_xpm[] = {
3
- "16 16 9 1",
4
- " c None",
5
- ". c #FF0000",
6
- "+ c #0000FF",
7
- "@ c #0023DB",
8
- "# c #00EA14",
9
- "$ c #00FF00",
10
- "% c #004FAF",
11
- "& c #0028D6",
12
- "* c #00F20C",
13
- " ",
14
- " ",
15
- " ",
16
- " ... +++@#$$$$ ",
17
- " .+ %& $$ ",
18
- " . + $ ",
19
- " . + $$ ",
20
- " . ++$$$$ ",
21
- " . + $$ ",
22
- " . + $ ",
23
- " . + $ ",
24
- " . + $ $$ ",
25
- " .....++++*$$ ",
26
- " ",
27
- " ",
28
- " "};
@@ -1,96 +0,0 @@
1
- /* XPM */
2
- static char * String_xpm[] = {
3
- "16 16 77 1",
4
- " c None",
5
- ". c #000000",
6
- "+ c #040404",
7
- "@ c #080806",
8
- "# c #090606",
9
- "$ c #EEEAE1",
10
- "% c #E7E3DA",
11
- "& c #E0DBD1",
12
- "* c #D4B46F",
13
- "= c #0C0906",
14
- "- c #E3C072",
15
- "; c #E4C072",
16
- "> c #060505",
17
- ", c #0B0A08",
18
- "' c #D5B264",
19
- ") c #D3AF5A",
20
- "! c #080602",
21
- "~ c #E1B863",
22
- "{ c #DDB151",
23
- "] c #DBAE4A",
24
- "^ c #DDB152",
25
- "/ c #DDB252",
26
- "( c #070705",
27
- "_ c #0C0A07",
28
- ": c #D3A33B",
29
- "< c #020201",
30
- "[ c #DAAA41",
31
- "} c #040302",
32
- "| c #E4D9BF",
33
- "1 c #0B0907",
34
- "2 c #030201",
35
- "3 c #020200",
36
- "4 c #C99115",
37
- "5 c #080704",
38
- "6 c #DBC8A2",
39
- "7 c #E7D7B4",
40
- "8 c #E0CD9E",
41
- "9 c #080601",
42
- "0 c #040400",
43
- "a c #010100",
44
- "b c #0B0B08",
45
- "c c #DCBF83",
46
- "d c #DCBC75",
47
- "e c #DEB559",
48
- "f c #040301",
49
- "g c #BC8815",
50
- "h c #120E07",
51
- "i c #060402",
52
- "j c #0A0804",
53
- "k c #D4A747",
54
- "l c #D6A12F",
55
- "m c #0E0C05",
56
- "n c #C8C1B0",
57
- "o c #1D1B15",
58
- "p c #D7AD51",
59
- "q c #070502",
60
- "r c #080804",
61
- "s c #BC953B",
62
- "t c #C4BDAD",
63
- "u c #0B0807",
64
- "v c #DBAC47",
65
- "w c #1B150A",
66
- "x c #B78A2C",
67
- "y c #D8A83C",
68
- "z c #D4A338",
69
- "A c #0F0B03",
70
- "B c #181105",
71
- "C c #C59325",
72
- "D c #C18E1F",
73
- "E c #060600",
74
- "F c #CC992D",
75
- "G c #B98B25",
76
- "H c #B3831F",
77
- "I c #C08C1C",
78
- "J c #060500",
79
- "K c #0E0C03",
80
- "L c #0D0A00",
81
- " ",
82
- " .+@# ",
83
- " .$%&*= ",
84
- " .-;>,')! ",
85
- " .~. .{]. ",
86
- " .^/. (_:< ",
87
- " .[.}|$12 ",
88
- " 345678}90 ",
89
- " a2bcdefgh ",
90
- " ijkl.mno ",
91
- " <pq. rstu ",
92
- " .]v. wx= ",
93
- " .yzABCDE ",
94
- " .FGHIJ ",
95
- " 0KL0 ",
96
- " "};
@@ -1,21 +0,0 @@
1
- /* XPM */
2
- static char * TrueClass_xpm[] = {
3
- "16 16 2 1",
4
- " c None",
5
- ". c #0BF311",
6
- " ",
7
- " ",
8
- " ",
9
- " ......... ",
10
- " . ",
11
- " . ",
12
- " . ",
13
- " . ",
14
- " . ",
15
- " . ",
16
- " . ",
17
- " . ",
18
- " . ",
19
- " ",
20
- " ",
21
- " "};
@@ -1,148 +0,0 @@
1
- # This file contains implementations of ruby core's custom objects for
2
- # serialisation/deserialisation.
3
-
4
- unless Object.const_defined?(:JSON) and ::JSON.const_defined?(:JSON_LOADED) and
5
- ::JSON::JSON_LOADED
6
- require 'json'
7
- end
8
- require 'date'
9
-
10
- class Symbol
11
- def to_json(*a)
12
- {
13
- JSON.create_id => self.class.name,
14
- 's' => to_s,
15
- }.to_json(*a)
16
- end
17
-
18
- def self.json_create(o)
19
- o['s'].to_sym
20
- end
21
- end
22
-
23
- class Time
24
- def self.json_create(object)
25
- if usec = object.delete('u') # used to be tv_usec -> tv_nsec
26
- object['n'] = usec * 1000
27
- end
28
- if respond_to?(:tv_nsec)
29
- at(*object.values_at('s', 'n'))
30
- else
31
- at(object['s'], object['n'] / 1000)
32
- end
33
- end
34
-
35
- def to_json(*args)
36
- {
37
- JSON.create_id => self.class.name,
38
- 's' => tv_sec,
39
- 'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000
40
- }.to_json(*args)
41
- end
42
- end
43
-
44
- class Date
45
- def self.json_create(object)
46
- civil(*object.values_at('y', 'm', 'd', 'sg'))
47
- end
48
-
49
- alias start sg unless method_defined?(:start)
50
-
51
- def to_json(*args)
52
- {
53
- JSON.create_id => self.class.name,
54
- 'y' => year,
55
- 'm' => month,
56
- 'd' => day,
57
- 'sg' => start,
58
- }.to_json(*args)
59
- end
60
- end
61
-
62
- class DateTime
63
- def self.json_create(object)
64
- args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
65
- of_a, of_b = object['of'].split('/')
66
- if of_b and of_b != '0'
67
- args << Rational(of_a.to_i, of_b.to_i)
68
- else
69
- args << of_a
70
- end
71
- args << object['sg']
72
- civil(*args)
73
- end
74
-
75
- alias start sg unless method_defined?(:start)
76
-
77
- def to_json(*args)
78
- {
79
- JSON.create_id => self.class.name,
80
- 'y' => year,
81
- 'm' => month,
82
- 'd' => day,
83
- 'H' => hour,
84
- 'M' => min,
85
- 'S' => sec,
86
- 'of' => offset.to_s,
87
- 'sg' => start,
88
- }.to_json(*args)
89
- end
90
- end
91
-
92
- class Range
93
- def self.json_create(object)
94
- new(*object['a'])
95
- end
96
-
97
- def to_json(*args)
98
- {
99
- JSON.create_id => self.class.name,
100
- 'a' => [ first, last, exclude_end? ]
101
- }.to_json(*args)
102
- end
103
- end
104
-
105
- class Struct
106
- def self.json_create(object)
107
- new(*object['v'])
108
- end
109
-
110
- def to_json(*args)
111
- klass = self.class.name
112
- klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
113
- {
114
- JSON.create_id => klass,
115
- 'v' => values,
116
- }.to_json(*args)
117
- end
118
- end
119
-
120
- class Exception
121
- def self.json_create(object)
122
- result = new(object['m'])
123
- result.set_backtrace object['b']
124
- result
125
- end
126
-
127
- def to_json(*args)
128
- {
129
- JSON.create_id => self.class.name,
130
- 'm' => message,
131
- 'b' => backtrace,
132
- }.to_json(*args)
133
- end
134
- end
135
-
136
- class Regexp
137
- def self.json_create(object)
138
- new(object['s'], object['o'])
139
- end
140
-
141
- def to_json(*)
142
- {
143
- JSON.create_id => self.class.name,
144
- 'o' => options,
145
- 's' => source,
146
- }.to_json
147
- end
148
- end