elster 0.0.8 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Users/jwebb/src/bigjason/elster/Gemfile.lock +79 -1
- data/Users/jwebb/src/bigjason/elster/README.md +16 -0
- data/Users/jwebb/src/bigjason/elster/elster.gemspec +2 -1
- data/Users/jwebb/src/bigjason/elster/lib/elster/elster_handler.rb +27 -0
- data/Users/jwebb/src/bigjason/elster/lib/elster/version.rb +1 -1
- data/Users/jwebb/src/bigjason/elster/lib/elster.rb +2 -0
- data/Users/jwebb/src/bigjason/elster/pkg/elster-0.0.8.gem +0 -0
- data/Users/jwebb/src/bigjason/elster/test/streamer_test.rb +1 -1
- metadata +23 -5
@@ -1,17 +1,58 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elster (0.
|
4
|
+
elster (0.1.1)
|
5
5
|
multi_json
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
actionmailer (3.2.9)
|
11
|
+
actionpack (= 3.2.9)
|
12
|
+
mail (~> 2.4.4)
|
13
|
+
actionpack (3.2.9)
|
14
|
+
activemodel (= 3.2.9)
|
15
|
+
activesupport (= 3.2.9)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
journey (~> 1.0.4)
|
19
|
+
rack (~> 1.4.0)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.2.1)
|
23
|
+
activemodel (3.2.9)
|
24
|
+
activesupport (= 3.2.9)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
activerecord (3.2.9)
|
27
|
+
activemodel (= 3.2.9)
|
28
|
+
activesupport (= 3.2.9)
|
29
|
+
arel (~> 3.0.2)
|
30
|
+
tzinfo (~> 0.3.29)
|
31
|
+
activeresource (3.2.9)
|
32
|
+
activemodel (= 3.2.9)
|
33
|
+
activesupport (= 3.2.9)
|
34
|
+
activesupport (3.2.9)
|
35
|
+
i18n (~> 0.6)
|
36
|
+
multi_json (~> 1.0)
|
10
37
|
ansi (1.4.0)
|
38
|
+
arel (3.0.2)
|
39
|
+
builder (3.0.4)
|
11
40
|
coderay (1.0.7)
|
41
|
+
erubis (2.7.0)
|
42
|
+
hike (1.2.1)
|
43
|
+
i18n (0.6.1)
|
44
|
+
journey (1.0.4)
|
45
|
+
json (1.7.5)
|
46
|
+
json (1.7.5-java)
|
47
|
+
mail (2.4.4)
|
48
|
+
i18n (>= 0.4.0)
|
49
|
+
mime-types (~> 1.16)
|
50
|
+
treetop (~> 1.4.8)
|
12
51
|
method_source (0.8)
|
52
|
+
mime-types (1.19)
|
13
53
|
minitest (3.3.0)
|
14
54
|
multi_json (1.3.7)
|
55
|
+
polyglot (0.3.3)
|
15
56
|
pry (0.9.10)
|
16
57
|
coderay (~> 1.0.5)
|
17
58
|
method_source (~> 0.8)
|
@@ -21,10 +62,46 @@ GEM
|
|
21
62
|
method_source (~> 0.8)
|
22
63
|
slop (~> 3.3.1)
|
23
64
|
spoon (~> 0.0)
|
65
|
+
rack (1.4.1)
|
66
|
+
rack-cache (1.2)
|
67
|
+
rack (>= 0.4)
|
68
|
+
rack-ssl (1.3.2)
|
69
|
+
rack
|
70
|
+
rack-test (0.6.2)
|
71
|
+
rack (>= 1.0)
|
72
|
+
rails (3.2.9)
|
73
|
+
actionmailer (= 3.2.9)
|
74
|
+
actionpack (= 3.2.9)
|
75
|
+
activerecord (= 3.2.9)
|
76
|
+
activeresource (= 3.2.9)
|
77
|
+
activesupport (= 3.2.9)
|
78
|
+
bundler (~> 1.0)
|
79
|
+
railties (= 3.2.9)
|
80
|
+
railties (3.2.9)
|
81
|
+
actionpack (= 3.2.9)
|
82
|
+
activesupport (= 3.2.9)
|
83
|
+
rack-ssl (~> 1.3.2)
|
84
|
+
rake (>= 0.8.7)
|
85
|
+
rdoc (~> 3.4)
|
86
|
+
thor (>= 0.14.6, < 2.0)
|
87
|
+
rake (10.0.2)
|
88
|
+
rdoc (3.12)
|
89
|
+
json (~> 1.4)
|
24
90
|
slop (3.3.2)
|
25
91
|
spoon (0.0.1)
|
92
|
+
sprockets (2.2.1)
|
93
|
+
hike (~> 1.2)
|
94
|
+
multi_json (~> 1.0)
|
95
|
+
rack (~> 1.0)
|
96
|
+
tilt (~> 1.1, != 1.3.0)
|
97
|
+
thor (0.16.0)
|
98
|
+
tilt (1.3.3)
|
99
|
+
treetop (1.4.12)
|
100
|
+
polyglot
|
101
|
+
polyglot (>= 0.3.1)
|
26
102
|
turn (0.8.3)
|
27
103
|
ansi
|
104
|
+
tzinfo (0.3.35)
|
28
105
|
|
29
106
|
PLATFORMS
|
30
107
|
java
|
@@ -34,4 +111,5 @@ DEPENDENCIES
|
|
34
111
|
elster!
|
35
112
|
minitest
|
36
113
|
pry
|
114
|
+
rails (>= 3.1)
|
37
115
|
turn
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# Elster
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/[bigjason]/[elster].png)](https://travis-ci.org/[bigjason]/[elster])
|
4
|
+
|
3
5
|
Elster is a streaming JSON encoder written in pure ruby.
|
4
6
|
|
5
7
|
## Installation
|
@@ -32,6 +34,20 @@ puts output.string
|
|
32
34
|
# {"name":"George","kids":["Job","Buster"]}
|
33
35
|
```
|
34
36
|
|
37
|
+
### With Rails
|
38
|
+
|
39
|
+
You can use Elster with rails by naming templates with the `.json.elster`
|
40
|
+
extension. When used as a rails template simply reference the implicit `json`
|
41
|
+
object. For example:
|
42
|
+
|
43
|
+
``` ruby
|
44
|
+
json.key(:name, "George")
|
45
|
+
json.key(:kids) do
|
46
|
+
json.add("Job")
|
47
|
+
json.add("Buster")
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
35
51
|
## Contributing
|
36
52
|
|
37
53
|
1. Fork it
|
@@ -5,7 +5,7 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ["Jason Webb"]
|
6
6
|
gem.email = ["bigjasonwebb@gmail.com"]
|
7
7
|
gem.summary = %q{A simple streaming JSON encoder.}
|
8
|
-
gem.homepage = ""
|
8
|
+
gem.homepage = "https://github.com/bigjason/elster"
|
9
9
|
|
10
10
|
gem.files = Dir["#{File.dirname(__FILE__)}/**/*"]
|
11
11
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_development_dependency "minitest"
|
20
20
|
gem.add_development_dependency "turn"
|
21
21
|
gem.add_development_dependency "pry"
|
22
|
+
gem.add_development_dependency "rails", ">= 3.1"
|
22
23
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Elster
|
2
|
+
class ElsterHandler
|
3
|
+
cattr_accessor :default_format
|
4
|
+
self.default_format = Mime::JSON
|
5
|
+
|
6
|
+
def supports_streaming?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.call(template)
|
11
|
+
%{
|
12
|
+
if defined?(json)
|
13
|
+
#{template.source}
|
14
|
+
else
|
15
|
+
output = StringIO.new
|
16
|
+
json = Elster::Streamer.new(output)
|
17
|
+
|
18
|
+
#{template.source}
|
19
|
+
json.close
|
20
|
+
output.string
|
21
|
+
end
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
ActionView::Template.register_template_handler :elster, Elster::ElsterHandler
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rails
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '3.1'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.1'
|
78
94
|
description:
|
79
95
|
email:
|
80
96
|
- bigjasonwebb@gmail.com
|
@@ -102,6 +118,7 @@ files:
|
|
102
118
|
- /Users/jwebb/src/bigjason/elster/elster.gemspec
|
103
119
|
- /Users/jwebb/src/bigjason/elster/Gemfile
|
104
120
|
- /Users/jwebb/src/bigjason/elster/Gemfile.lock
|
121
|
+
- /Users/jwebb/src/bigjason/elster/lib/elster/elster_handler.rb
|
105
122
|
- /Users/jwebb/src/bigjason/elster/lib/elster/exceptions.rb
|
106
123
|
- /Users/jwebb/src/bigjason/elster/lib/elster/streamer.rb
|
107
124
|
- /Users/jwebb/src/bigjason/elster/lib/elster/version.rb
|
@@ -112,10 +129,11 @@ files:
|
|
112
129
|
- /Users/jwebb/src/bigjason/elster/pkg/elster-0.0.5.gem
|
113
130
|
- /Users/jwebb/src/bigjason/elster/pkg/elster-0.0.6.gem
|
114
131
|
- /Users/jwebb/src/bigjason/elster/pkg/elster-0.0.7.gem
|
132
|
+
- /Users/jwebb/src/bigjason/elster/pkg/elster-0.0.8.gem
|
115
133
|
- /Users/jwebb/src/bigjason/elster/Rakefile
|
116
134
|
- /Users/jwebb/src/bigjason/elster/README.md
|
117
135
|
- /Users/jwebb/src/bigjason/elster/test/streamer_test.rb
|
118
|
-
homepage:
|
136
|
+
homepage: https://github.com/bigjason/elster
|
119
137
|
licenses: []
|
120
138
|
post_install_message:
|
121
139
|
rdoc_options: []
|
@@ -129,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
147
|
version: '0'
|
130
148
|
segments:
|
131
149
|
- 0
|
132
|
-
hash: -
|
150
|
+
hash: -247596212203680620
|
133
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
152
|
none: false
|
135
153
|
requirements:
|
@@ -138,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
156
|
version: '0'
|
139
157
|
segments:
|
140
158
|
- 0
|
141
|
-
hash: -
|
159
|
+
hash: -247596212203680620
|
142
160
|
requirements: []
|
143
161
|
rubyforge_project:
|
144
162
|
rubygems_version: 1.8.24
|