gon-sinatra 0.0.5 → 0.0.6
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.
- data/Gemfile.lock +20 -48
- data/README.md +2 -2
- data/lib/gon/sinatra/helpers.rb +4 -2
- data/lib/gon/sinatra/version.rb +1 -1
- metadata +10 -16
- data/spec/test_data/_sample_partial.json.jbuilder +0 -1
- data/spec/test_data/sample.json.jbuilder +0 -1
- data/spec/test_data/sample_with_partial.json.jbuilder +0 -1
data/Gemfile.lock
CHANGED
@@ -1,70 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gon (
|
5
|
-
actionpack (>= 2.3.0)
|
6
|
-
jbuilder
|
4
|
+
gon-sinatra (0.0.5)
|
7
5
|
json
|
8
6
|
rabl
|
7
|
+
sinatra
|
9
8
|
|
10
9
|
GEM
|
11
10
|
remote: http://rubygems.org/
|
12
11
|
specs:
|
13
|
-
|
14
|
-
activemodel (= 3.1.1)
|
15
|
-
activesupport (= 3.1.1)
|
16
|
-
builder (~> 3.0.0)
|
17
|
-
erubis (~> 2.7.0)
|
18
|
-
i18n (~> 0.6)
|
19
|
-
rack (~> 1.3.2)
|
20
|
-
rack-cache (~> 1.1)
|
21
|
-
rack-mount (~> 0.8.2)
|
22
|
-
rack-test (~> 0.6.1)
|
23
|
-
sprockets (~> 2.0.2)
|
24
|
-
activemodel (3.1.1)
|
25
|
-
activesupport (= 3.1.1)
|
26
|
-
builder (~> 3.0.0)
|
27
|
-
i18n (~> 0.6)
|
28
|
-
activesupport (3.1.1)
|
12
|
+
activesupport (3.1.3)
|
29
13
|
multi_json (~> 1.0)
|
30
|
-
blankslate (2.1.2.4)
|
31
|
-
builder (3.0.0)
|
32
14
|
diff-lcs (1.1.3)
|
33
|
-
|
34
|
-
hike (1.2.1)
|
35
|
-
i18n (0.6.0)
|
36
|
-
jbuilder (0.3)
|
37
|
-
activesupport (>= 3.0.0)
|
38
|
-
blankslate (>= 2.1.2.4)
|
39
|
-
json (1.6.1)
|
15
|
+
json (1.6.4)
|
40
16
|
multi_json (1.0.4)
|
41
|
-
rabl (0.5.
|
17
|
+
rabl (0.5.3)
|
42
18
|
activesupport (>= 2.3.14)
|
43
19
|
multi_json (~> 1.0.3)
|
44
|
-
rack (1.
|
45
|
-
rack-
|
46
|
-
rack
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
rspec (2.
|
52
|
-
|
53
|
-
rspec-expectations (~> 2.7.0)
|
54
|
-
rspec-mocks (~> 2.7.0)
|
55
|
-
rspec-core (2.7.1)
|
56
|
-
rspec-expectations (2.7.0)
|
20
|
+
rack (1.4.0)
|
21
|
+
rack-protection (1.2.0)
|
22
|
+
rack
|
23
|
+
rspec (2.8.0)
|
24
|
+
rspec-core (~> 2.8.0)
|
25
|
+
rspec-expectations (~> 2.8.0)
|
26
|
+
rspec-mocks (~> 2.8.0)
|
27
|
+
rspec-core (2.8.0)
|
28
|
+
rspec-expectations (2.8.0)
|
57
29
|
diff-lcs (~> 1.1.2)
|
58
|
-
rspec-mocks (2.
|
59
|
-
|
60
|
-
|
61
|
-
rack (~> 1.
|
62
|
-
tilt (
|
30
|
+
rspec-mocks (2.8.0)
|
31
|
+
sinatra (1.3.2)
|
32
|
+
rack (>= 1.3.6, ~> 1.3)
|
33
|
+
rack-protection (~> 1.2)
|
34
|
+
tilt (>= 1.3.3, ~> 1.3)
|
63
35
|
tilt (1.3.3)
|
64
36
|
|
65
37
|
PLATFORMS
|
66
38
|
ruby
|
67
39
|
|
68
40
|
DEPENDENCIES
|
69
|
-
gon!
|
41
|
+
gon-sinatra!
|
70
42
|
rspec
|
data/README.md
CHANGED
@@ -118,7 +118,7 @@ That's what you need to do:
|
|
118
118
|
# some logic
|
119
119
|
@posts = [some_objects] # Rabl works with instance variables of controller
|
120
120
|
|
121
|
-
gon.rabl 'goners/posts/index.rabl'
|
121
|
+
gon.rabl 'goners/posts/index.rabl', :instance => self
|
122
122
|
# some logic
|
123
123
|
end
|
124
124
|
```
|
@@ -162,7 +162,7 @@ gon mapping method:
|
|
162
162
|
``` ruby
|
163
163
|
# your logic stuff here
|
164
164
|
|
165
|
-
gon.rabl 'path/to/rabl/file', :as => 'alias'
|
165
|
+
gon.rabl 'path/to/rabl/file', :as => 'alias', :instance => self
|
166
166
|
```
|
167
167
|
|
168
168
|
## Installation
|
data/lib/gon/sinatra/helpers.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Gon
|
2
4
|
module Sinatra
|
3
5
|
module Helpers
|
@@ -13,11 +15,11 @@ module Gon
|
|
13
15
|
script = "<script>window." + namespace + " = {};"
|
14
16
|
unless options[:camel_case]
|
15
17
|
data.each do |key, val|
|
16
|
-
script += namespace + "." + key.to_s + '=' + val.
|
18
|
+
script += namespace + "." + key.to_s + '=' + val.to_json + ";"
|
17
19
|
end
|
18
20
|
else
|
19
21
|
data.each do |key, val|
|
20
|
-
script += namespace + "." + key.to_s.camelize(:lower) + '=' + val.
|
22
|
+
script += namespace + "." + key.to_s.camelize(:lower) + '=' + val.to_json + ";"
|
21
23
|
end
|
22
24
|
end
|
23
25
|
script += "</script>"
|
data/lib/gon/sinatra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gon-sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rabl
|
16
|
-
requirement: &
|
16
|
+
requirement: &2165738300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2165738300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sinatra
|
27
|
-
requirement: &
|
27
|
+
requirement: &2165737860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2165737860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2165737420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2165737420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &2165736980 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2165736980
|
58
58
|
description: If you need to send some data to your js files and you don't want to
|
59
59
|
do this with long way trough views and parsing - use this force!
|
60
60
|
email:
|
@@ -82,10 +82,7 @@ files:
|
|
82
82
|
- pkg/gon-0.3.0.gem
|
83
83
|
- pkg/gon-1.0.0.gem
|
84
84
|
- spec/gon/gon_spec.rb
|
85
|
-
- spec/test_data/_sample_partial.json.jbuilder
|
86
|
-
- spec/test_data/sample.json.jbuilder
|
87
85
|
- spec/test_data/sample.rabl
|
88
|
-
- spec/test_data/sample_with_partial.json.jbuilder
|
89
86
|
homepage: https://github.com/gazay/gon-sinatra
|
90
87
|
licenses: []
|
91
88
|
post_install_message:
|
@@ -112,7 +109,4 @@ specification_version: 3
|
|
112
109
|
summary: Get your Sinatra variables in your JS
|
113
110
|
test_files:
|
114
111
|
- spec/gon/gon_spec.rb
|
115
|
-
- spec/test_data/_sample_partial.json.jbuilder
|
116
|
-
- spec/test_data/sample.json.jbuilder
|
117
112
|
- spec/test_data/sample.rabl
|
118
|
-
- spec/test_data/sample_with_partial.json.jbuilder
|
@@ -1 +0,0 @@
|
|
1
|
-
json.objects objects
|
@@ -1 +0,0 @@
|
|
1
|
-
json.objects @objects
|
@@ -1 +0,0 @@
|
|
1
|
-
json.partial! 'spec/test_data/_sample_partial.json.jbuilder', :objects => @objects
|