serbea 0.10.0 → 0.10.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/serbea/helpers.rb +6 -27
  3. data/lib/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7961cb287d077b528dd0367681aee6087a5efc9b3838670e7f8c7072b09c9ad
4
- data.tar.gz: ca1a4701f70e49e28c67dfb407018dfd56eaf42391a0aa4230e1a15dc1b57f86
3
+ metadata.gz: 2b926b4c2862564b92db8e06de1c440827b96165cd63397e2c757cfcd2c077b0
4
+ data.tar.gz: f6a31873aa5eecf6bc23ea2878b81b5b4872f30cd89debed7a313d4e98992e47
5
5
  SHA512:
6
- metadata.gz: 84036346ec67f5789c380bd0772f1da6644223e1b82f6a5974de93c9c3b82c98b34c5a6f27c8c69dbb598b230a24b33a0ae16a9bee3a284b494eec81cec9f0ff
7
- data.tar.gz: 78da2c4e5f3828153b9933fd0173475aaacdf3bb42e4a56a4ec69f12b6991488559a7cfb57f8f1a64008173dd280b7c3c47de4daebc4cda537ed3638c7af3cbc
6
+ metadata.gz: 4bf447cc67c26721d64a3cbc37b12519894a54e7e8ce03f0c801b4a0e273e29309179a5ac753c728cc8f9ccfd787a1b58ce554022905f57f1d14feb295b1cd26
7
+ data.tar.gz: 1ba95acd1ba3905b3e41a109c1044e052d59a0a71c0b4f231c59c9f65d45af73c568f95486b30a2b13aa5a6eace5a250122b230db682bf77a8dd9f36afef9871
@@ -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(obj = nil, &block)
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
- @output_buffer = previous_ob_state
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
@@ -1,3 +1,3 @@
1
1
  module Serbea
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serbea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team