turbostreamer 1.7.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f88c7e8d509e97aa6d2d2604f4a36c1e2d4cc5bb6b15393390681b93d570a893
4
- data.tar.gz: 454ca8f3167263308d397fc66ffaafc3858e4078fed5109a325932c8c890c664
3
+ metadata.gz: 63f1e21caf6c87b095cbd4528226ebbc0489dc7f58ef6de192ed222b1920863e
4
+ data.tar.gz: d7e9e7237f6fe49b46c114a39da1b6983db8cdc758a4b0d10cb9ce97d65a7ad4
5
5
  SHA512:
6
- metadata.gz: 225cfb941767f0f3c45d0b1458aaabd9815f121af909e35534a40f3a71502297ea0dd1b72ca943f0f8d7fb11944ccea64283668d86b3e34c977958e1170edb46
7
- data.tar.gz: 22ec94ce3cd8e5e1b81c7373d021297e66bedaadbc7fb780c765cf0c7ff752447b9e13e7de84ec5e114620de3af598d225331a7303ec06d31dc78191971c2295
6
+ metadata.gz: 69a4204a0598eb92fae7a08c1385241b0f648998eb5f6762c42bd61c8ded3689078ed1930b06e15383fc5ab744f5e1f8b85b6efd2eda58cbc125831683a8ca30
7
+ data.tar.gz: e8002ae1e4369b59071dff8a74f3f57d2e51d63c242c86023e174c6fb00b74b9777defa68e5e1241ace35bbf24e4a92d6dd275870155b18e4438d732e5807896
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # TurboStreamer [![Build Status](https://api.travis-ci.org/malomalo/turbostreamer.svg)](https://travis-ci.org/malomalo/turbostreamer)
1
+ # TurboStreamer
2
2
 
3
3
  TurboStreamer gives you a simple DSL for generating JSON that beats massaging giant
4
4
  hash structures. This is particularly helpful when the generation process is
@@ -299,7 +299,8 @@ TurboStreamer.encode(encoder: TurboStreamer::WankelEncoder)
299
299
  TurboStreamer.encode(encoder: MyEncoder)
300
300
  ```
301
301
 
302
- # Setting the default encoder and options
302
+ Setting the default encoder and options
303
+ ---------------------------------------
303
304
  If you need explicitly set the default:
304
305
 
305
306
  ```ruby
@@ -339,6 +340,20 @@ All backends must have the following functions:
339
340
  - `inject(string)` Inject a (usually cached) string into the output; instering any delimiters as needed.
340
341
  - `capture(&block)` Capture the output of the block (w/o any delimiters)
341
342
 
343
+ Benchmark
344
+ ---------
345
+ `gnuplot` is required to run benchmark, to install:
346
+ - `brew install gnuplot` (MacOS)
347
+
348
+ `yajl` is required to install a development dependency [`wankel`](https://github.com/malomalo/wankel), to install:
349
+ - `brew install yajl` (MacOS)
350
+
351
+ To run benchmark: `bundle exec rake performance`
352
+
353
+ This will produce 2 graph images on in folders
354
+ - `performance/dirk`
355
+ - `performance/rolftimmermans`
356
+
342
357
  Special Thanks & Contributors
343
358
  -----------------------------
344
359
 
@@ -1,18 +1,18 @@
1
1
  module ActionView
2
2
  class StreamingTemplateRenderer < TemplateRenderer
3
3
 
4
- def render_template(template, layout_name = nil, locals = {}) #:nodoc:
4
+ def render_template(view, template, layout_name = nil, locals = {}) #:nodoc:
5
5
  template_supports_streaming = (layout_name && template.supports_streaming?) || template.handler == TurboStreamer::Handler
6
- return [super] unless template_supports_streaming
6
+ return [super.body] unless layout_name && template_supports_streaming
7
7
 
8
8
  locals ||= {}
9
9
  layout = layout_name && find_layout(layout_name, locals.keys, [formats.first])
10
10
 
11
11
  Body.new do |buffer|
12
12
  if template.handler == TurboStreamer::Handler
13
- delayed_render_json(buffer, template, layout, @view, locals)
13
+ delayed_render_json(buffer, template, layout, view, locals)
14
14
  else
15
- delayed_render(buffer, template, layout, @view, locals)
15
+ delayed_render(buffer, template, layout, view, locals)
16
16
  end
17
17
  end
18
18
  end
@@ -106,8 +106,8 @@ class TurboStreamer::Template < TurboStreamer
106
106
  # json.cache_if! !admin?, @person, expires_in: 10.minutes do
107
107
  # json.extract! @person, :name, :age
108
108
  # end
109
- def cache_if!(condition, *args)
110
- condition ? cache!(*args, &::Proc.new) : yield
109
+ def cache_if!(condition, *args, &block)
110
+ condition ? cache!(*args, &block) : yield
111
111
  end
112
112
 
113
113
  private
@@ -215,7 +215,7 @@ class TurboStreamer::Template < TurboStreamer
215
215
  if @context.respond_to?(:cache_fragment_name)
216
216
  # Current compatibility, fragment_name_with_digest is private again and cache_fragment_name
217
217
  # should be used instead.
218
- @context.cache_fragment_name(key, options)
218
+ @context.cache_fragment_name(key, **options)
219
219
  elsif @context.respond_to?(:fragment_name_with_digest)
220
220
  # Backwards compatibility for period of time when fragment_name_with_digest was made public.
221
221
  @context.fragment_name_with_digest(key)
@@ -1,3 +1,3 @@
1
1
  class TurboStreamer
2
- VERSION = '1.7.0'
2
+ VERSION = '1.10.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbostreamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -192,7 +192,21 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- description:
195
+ - !ruby/object:Gem::Dependency
196
+ name: multi_json
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ description:
196
210
  email:
197
211
  - jonbracy@gmail.com
198
212
  executables: []
@@ -217,7 +231,7 @@ homepage: https://github.com/malomalo/turbostreamer
217
231
  licenses:
218
232
  - MIT
219
233
  metadata: {}
220
- post_install_message:
234
+ post_install_message:
221
235
  rdoc_options:
222
236
  - "--main"
223
237
  - README.md
@@ -227,15 +241,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
241
  requirements:
228
242
  - - ">="
229
243
  - !ruby/object:Gem::Version
230
- version: '0'
244
+ version: '2.5'
231
245
  required_rubygems_version: !ruby/object:Gem::Requirement
232
246
  requirements:
233
247
  - - ">="
234
248
  - !ruby/object:Gem::Version
235
249
  version: '0'
236
250
  requirements: []
237
- rubygems_version: 3.0.3
238
- signing_key:
251
+ rubygems_version: 3.2.22
252
+ signing_key:
239
253
  specification_version: 4
240
254
  summary: Stream JSON via a Builder-style DSL
241
255
  test_files: []