json_builder 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/json_builder/extensions.rb +15 -6
- data/lib/json_builder/version.rb +1 -1
- data/test/compiler_test.rb +6 -0
- metadata +6 -18
data/Gemfile.lock
CHANGED
@@ -14,7 +14,16 @@ end
|
|
14
14
|
|
15
15
|
class String
|
16
16
|
def to_builder
|
17
|
-
"
|
17
|
+
%("#{json_escape}")
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def json_escape
|
23
|
+
self.gsub(/\n/, '\\n')
|
24
|
+
.gsub(/\r/, '\\r')
|
25
|
+
.gsub(/\t/, '\\t')
|
26
|
+
.gsub(/\f/, '\\f')
|
18
27
|
end
|
19
28
|
end
|
20
29
|
|
@@ -33,33 +42,33 @@ end
|
|
33
42
|
module ActiveSupport
|
34
43
|
class TimeWithZone
|
35
44
|
def to_builder
|
36
|
-
"
|
45
|
+
%("#{iso8601}")
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
40
49
|
|
41
50
|
class Time
|
42
51
|
def to_builder
|
43
|
-
"
|
52
|
+
%("#{iso8601}")
|
44
53
|
end
|
45
54
|
end
|
46
55
|
|
47
56
|
class Date
|
48
57
|
def to_builder
|
49
|
-
"
|
58
|
+
%("#{to_time.iso8601}")
|
50
59
|
end
|
51
60
|
end
|
52
61
|
|
53
62
|
class DateTime
|
54
63
|
def to_builder
|
55
|
-
"
|
64
|
+
%("#{to_time.iso8601}")
|
56
65
|
end
|
57
66
|
end
|
58
67
|
|
59
68
|
module BSON
|
60
69
|
class ObjectId
|
61
70
|
def to_builder
|
62
|
-
"
|
71
|
+
%("#{self}")
|
63
72
|
end
|
64
73
|
end
|
65
74
|
end
|
data/lib/json_builder/version.rb
CHANGED
data/test/compiler_test.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 3
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 3.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 3.1.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Garrett Bjerkhoel
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2012-
|
18
|
-
default_executable:
|
13
|
+
date: 2012-04-04 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: activesupport
|
@@ -24,10 +19,6 @@ dependencies:
|
|
24
19
|
requirements:
|
25
20
|
- - ">="
|
26
21
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 2
|
29
|
-
- 0
|
30
|
-
- 0
|
31
22
|
version: 2.0.0
|
32
23
|
type: :runtime
|
33
24
|
prerelease: false
|
@@ -39,8 +30,6 @@ dependencies:
|
|
39
30
|
requirements:
|
40
31
|
- - ">="
|
41
32
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 0
|
44
33
|
version: "0"
|
45
34
|
type: :development
|
46
35
|
prerelease: false
|
@@ -78,7 +67,6 @@ files:
|
|
78
67
|
- test/member_test.rb
|
79
68
|
- test/test_helper.rb
|
80
69
|
- test/value_test.rb
|
81
|
-
has_rdoc: true
|
82
70
|
homepage:
|
83
71
|
licenses: []
|
84
72
|
|
@@ -92,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
80
|
requirements:
|
93
81
|
- - ">="
|
94
82
|
- !ruby/object:Gem::Version
|
95
|
-
hash:
|
83
|
+
hash: 1983808779461628758
|
96
84
|
segments:
|
97
85
|
- 0
|
98
86
|
version: "0"
|
@@ -101,14 +89,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
89
|
requirements:
|
102
90
|
- - ">="
|
103
91
|
- !ruby/object:Gem::Version
|
104
|
-
hash:
|
92
|
+
hash: 1983808779461628758
|
105
93
|
segments:
|
106
94
|
- 0
|
107
95
|
version: "0"
|
108
96
|
requirements: []
|
109
97
|
|
110
98
|
rubyforge_project:
|
111
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 1.8.17
|
112
100
|
signing_key:
|
113
101
|
specification_version: 3
|
114
102
|
summary: Rails provides an excellent XML Builder by default to build RSS and ATOM feeds, but nothing to help you build complex and custom JSON data structures. The standard to_json works well, but can get very verbose when you need full control of what is generated. JSON Builder hopes to solve that problem.
|