async_partial 0.1.0 → 0.2.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
- SHA256:
3
- metadata.gz: 882b52321e8ff16c31b7d2bf2d1da62cefe0cdb110d991adb9ce2568ba376c4d
4
- data.tar.gz: 606224d8511358400a66f00de2f5ffa0f2e475bf71b6421ae8f8c0877dace95a
2
+ SHA1:
3
+ metadata.gz: 2cabb9dbc691bdd59d655c9112d8ea4c55a69d7e
4
+ data.tar.gz: a3fe4c7eedbfe32adc455040ba523c203dc7e772
5
5
  SHA512:
6
- metadata.gz: 0e04df603347440d1eef9e684288185b70f58f3e6fd5b44822398b007034be425d639cc68071a6a17ad777622f2ed02f9f58af3f4501ed3102830ce36ca3af6b
7
- data.tar.gz: 4c752826a21b0bfa4c89de52d02479a8d68b9af2ce5ae2aa6882fbdc2997e567ff1850c9bae99652180a85985afcff404ded97171f58586dec14128db7a0747f
6
+ metadata.gz: f1c7200dd2026f609343ec8e07715e0ae47f6fe32746d1d59e1c2b9ea867bc39860e758f6de4bfe41bbb867603f3e2c126e05300f7fb6d0eef51175a8eda161e
7
+ data.tar.gz: 3e793b8ad729af2404bf238c87a050ceae5fee9536ae0d547379b81a7b0ee9a98ca259cddc2fe2661f1c2df380db52f6a666b7bc1376834ae266d9b3a2c103e0
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "async_partial"
6
- spec.version = '0.1.0'.freeze
6
+ spec.version = '0.2.0'.freeze
7
7
  spec.authors = ["Akira Matsuda"]
8
8
  spec.email = ["ronnie@dio.jp"]
9
9
 
data/lib/async_partial.rb CHANGED
@@ -22,6 +22,10 @@ module AsyncPartial
22
22
  false
23
23
  end
24
24
 
25
+ def html_safe?
26
+ true
27
+ end
28
+
25
29
  def to_s
26
30
  val = @thread.value
27
31
  @thread.kill
@@ -33,7 +37,6 @@ module AsyncPartial
33
37
  def initialize(*)
34
38
  super
35
39
  @values = []
36
- @caller = caller[0]
37
40
  end
38
41
 
39
42
  def <<(value)
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Temple
4
+ module Generators
5
+ # Implements a threaded rails output buffer.
6
+ #
7
+ # output_buffer = ActionView::OutputBuffer.new
8
+ # output_buffer.safe_concat "static"
9
+ # output_buffer.safe_concat dynamic
10
+ # output_buffer.to_s
11
+ class ThreadedRailsOutputBuffer < RailsOutputBuffer
12
+ set_options buffer_class: 'ActionView::OutputBuffer', buffer: 'output_buffer'
13
+
14
+ def on_dynamic(code)
15
+ concat(code)
16
+ end
17
+
18
+ def return_buffer
19
+ "#{buffer}.to_s"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -14,6 +14,13 @@ module AsyncPartial
14
14
  ActionView::Template::Handlers::ERB.erb_implementation = ActionView::Template::Handlers::ERB::ThreadSafeErubi
15
15
  rescue LoadError
16
16
  end
17
+
18
+ if Gem.loaded_specs.detect {|g| g[0] == 'slim'}
19
+ require 'temple/generators/rails_output_buffer'
20
+ require_relative 'handlers/slim'
21
+
22
+ Temple::Templates::Rails(Slim::Engine, register_as: :slim, generator: Temple::Generators::ThreadedRailsOutputBuffer, disable_capture: true, streaming: true)
23
+ end
17
24
  end
18
25
  end
19
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async_partial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
@@ -84,6 +84,7 @@ files:
84
84
  - bin/setup
85
85
  - lib/async_partial.rb
86
86
  - lib/async_partial/handlers/erubi.rb
87
+ - lib/async_partial/handlers/slim.rb
87
88
  - lib/async_partial/railtie.rb
88
89
  homepage: https://github.com/amatsuda/async_partial
89
90
  licenses:
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  version: '0'
106
107
  requirements: []
107
108
  rubyforge_project:
108
- rubygems_version: 2.7.4
109
+ rubygems_version: 2.5.2.2
109
110
  signing_key:
110
111
  specification_version: 4
111
112
  summary: Asynchronous partial renderer for Rails