serbea 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/serbea/helpers.rb +6 -27
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b926b4c2862564b92db8e06de1c440827b96165cd63397e2c757cfcd2c077b0
|
4
|
+
data.tar.gz: f6a31873aa5eecf6bc23ea2878b81b5b4872f30cd89debed7a313d4e98992e47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bf447cc67c26721d64a3cbc37b12519894a54e7e8ce03f0c801b4a0e273e29309179a5ac753c728cc8f9ccfd787a1b58ce554022905f57f1d14feb295b1cd26
|
7
|
+
data.tar.gz: 1ba95acd1ba3905b3e41a109c1044e052d59a0a71c0b4f231c59c9f65d45af73c568f95486b30a2b13aa5a6eace5a250122b230db682bf77a8dd9f36afef9871
|
data/lib/serbea/helpers.rb
CHANGED
@@ -6,52 +6,31 @@ module Serbea
|
|
6
6
|
Serbea::Pipeline.deny_value_method %i(escape h prepend append assign_to)
|
7
7
|
end
|
8
8
|
|
9
|
-
def capture(
|
9
|
+
def capture(*args)
|
10
10
|
previous_buffer_state = @_erbout
|
11
11
|
@_erbout = Serbea::OutputBuffer.new
|
12
|
-
|
13
|
-
# For compatibility with ActionView, not used by Bridgetown normally
|
14
|
-
previous_ob_state = @output_buffer
|
15
|
-
@output_buffer = Serbea::OutputBuffer.new
|
16
|
-
|
17
|
-
|
18
|
-
result = instance_exec(obj, &block)
|
19
|
-
if @output_buffer != ""
|
20
|
-
# use Rails' ActionView buffer if present
|
21
|
-
result = @output_buffer
|
22
|
-
end
|
12
|
+
result = yield(*args)
|
23
13
|
@_erbout = previous_buffer_state
|
24
|
-
@output_buffer = previous_ob_state
|
25
14
|
|
26
15
|
result&.html_safe
|
27
16
|
end
|
28
|
-
|
17
|
+
|
29
18
|
def pipeline(context, value)
|
30
19
|
Pipeline.new(context, value)
|
31
20
|
end
|
32
|
-
|
21
|
+
|
33
22
|
def helper(name, &helper_block)
|
34
23
|
self.class.define_method(name) do |*args, &block|
|
35
24
|
previous_buffer_state = @_erbout
|
36
25
|
@_erbout = Serbea::OutputBuffer.new
|
37
|
-
|
38
|
-
# For compatibility with ActionView, not used by Bridgetown normally
|
39
|
-
previous_ob_state = @output_buffer
|
40
|
-
@output_buffer = Serbea::OutputBuffer.new
|
41
|
-
|
42
26
|
result = helper_block.call(*args, &block)
|
43
|
-
if @output_buffer != ""
|
44
|
-
# use Rails' ActionView buffer if present
|
45
|
-
result = @output_buffer
|
46
|
-
end
|
47
27
|
@_erbout = previous_buffer_state
|
48
|
-
|
49
|
-
|
28
|
+
|
50
29
|
result.is_a?(String) ? result.html_safe : result
|
51
30
|
end
|
52
31
|
end
|
53
32
|
alias_method :macro, :helper
|
54
|
-
|
33
|
+
|
55
34
|
def h(input)
|
56
35
|
ERB::Util.h(input.to_s)
|
57
36
|
end
|
data/lib/version.rb
CHANGED