async_partial 0.1.0 → 0.2.0
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.
- checksums.yaml +5 -5
- data/async_partial.gemspec +1 -1
- data/lib/async_partial.rb +4 -1
- data/lib/async_partial/handlers/slim.rb +23 -0
- data/lib/async_partial/railtie.rb +7 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2cabb9dbc691bdd59d655c9112d8ea4c55a69d7e
|
4
|
+
data.tar.gz: a3fe4c7eedbfe32adc455040ba523c203dc7e772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1c7200dd2026f609343ec8e07715e0ae47f6fe32746d1d59e1c2b9ea867bc39860e758f6de4bfe41bbb867603f3e2c126e05300f7fb6d0eef51175a8eda161e
|
7
|
+
data.tar.gz: 3e793b8ad729af2404bf238c87a050ceae5fee9536ae0d547379b81a7b0ee9a98ca259cddc2fe2661f1c2df380db52f6a666b7bc1376834ae266d9b3a2c103e0
|
data/async_partial.gemspec
CHANGED
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.
|
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.
|
109
|
+
rubygems_version: 2.5.2.2
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: Asynchronous partial renderer for Rails
|