phlex-rails 0.8.0 → 0.9.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: 00fc3d53f19d10aee8a5a0c3aac7c77d5a753caa641dd92524acf1327a3e6a4f
4
- data.tar.gz: b5574038403fbdf9aba3de312446c3fd027f6f2a98c7bffe50f36ee8ab44f09c
3
+ metadata.gz: 64bd1c0569d8a687689b1eec091acff484e3c3c7db388f80ddc1cb059881c680
4
+ data.tar.gz: 282af2d851aaef5e1266519b59ba5ade1360cd13666d629b4109441f16abb6f6
5
5
  SHA512:
6
- metadata.gz: 68e1dd45327362c06b9cc7b07efcbba51916c34cf3de4e8b42891dee24f20f98a12dec011fe35d7cc6067f5b610339020de43ed6c4ffbc817671a5f1ff8305b1
7
- data.tar.gz: f671b7275caf0bb733d385cd7310388ab5a82475131bb08d937692f3ed57aeba7bd8788d2bd23856a5e08435cc21924c733238d5c391b82bf2bee9d281453ce1
6
+ metadata.gz: e9f65f079a1ec7372692767beb7f7f1f70dac50f4429f429aa0085bbfefcd40675e2933985d728ed2354fb90983d86a707d1f5432c3333f72f843032086c7924
7
+ data.tar.gz: 7e5f5fe2316c5db3ae8757a67517856ffdebf4f5b03467d17a712eb6c571486f402ceeb993cd1ceba31c3a7cfef37aa104ed297123be43fb30cb2af790775530
@@ -29,7 +29,7 @@ module Phlex::Rails
29
29
 
30
30
  case output
31
31
  when ::ActiveSupport::SafeBuffer
32
- @view.instance_variable_get(:@_target) << output
32
+ @view.instance_variable_get(:@_context).target << output
33
33
  end
34
34
 
35
35
  nil
@@ -56,7 +56,7 @@ module Phlex::Rails
56
56
 
57
57
  case output
58
58
  when ::ActiveSupport::SafeBuffer
59
- @view.instance_variable_get(:@_target) << output
59
+ @view.instance_variable_get(:@_context).target << output
60
60
  end
61
61
 
62
62
  nil
@@ -11,7 +11,7 @@ module Phlex::Rails::HelperMacros
11
11
 
12
12
  case output
13
13
  when ActiveSupport::SafeBuffer
14
- @_target << output
14
+ @_context.target << output
15
15
  end
16
16
 
17
17
  nil
@@ -32,7 +32,7 @@ module Phlex::Rails::HelperMacros
32
32
 
33
33
  case output
34
34
  when ActiveSupport::SafeBuffer
35
- @_target << output
35
+ @_context.target << output
36
36
  end
37
37
 
38
38
  nil
@@ -85,7 +85,7 @@ module Phlex::Rails::HelperMacros
85
85
 
86
86
  case output
87
87
  when ActiveSupport::SafeBuffer
88
- @_target << output
88
+ @_context.target << output
89
89
  end
90
90
 
91
91
  nil
@@ -10,7 +10,7 @@ module Phlex::Rails::Helpers::Tag
10
10
 
11
11
  case result
12
12
  when ActiveSupport::SafeBuffer
13
- @_target << result
13
+ @_context.target << result
14
14
  when ActionView::Helpers::TagHelper::TagBuilder
15
15
  Phlex::Rails::Buffered.new(
16
16
  result,
@@ -12,14 +12,18 @@ module Phlex
12
12
  end
13
13
  end
14
14
 
15
- def render(renderable = nil, *args, **kwargs, &block)
16
- return super if renderable.is_a?(Phlex::SGML)
17
- return super if renderable.is_a?(Class) && renderable < Phlex::SGML
15
+ def render(*args, **kwargs, &block)
16
+ renderable = args[0]
18
17
 
19
- if renderable
20
- @_target << @_view_context.render(renderable, *args, **kwargs, &block)
18
+ case renderable
19
+ when Phlex::SGML, Proc
20
+ return super
21
+ when Class
22
+ return super if renderable < Phlex::SGML
23
+ when Enumerable
24
+ return super unless renderable.is_a?(ActiveRecord::Relation)
21
25
  else
22
- @_target << @_view_context.render(*args, **kwargs, &block)
26
+ @_context.target << @_view_context.render(*args, **kwargs, &block)
23
27
  end
24
28
 
25
29
  nil
@@ -28,7 +32,7 @@ module Phlex
28
32
  def render_in(view_context, &block)
29
33
  if block_given?
30
34
  call(view_context: view_context) do |*args|
31
- original_length = @_target.length
35
+ original_length = @_context.target.length
32
36
 
33
37
  if args.length == 1 && Phlex::SGML === args[0]
34
38
  output = view_context.capture(
@@ -38,12 +42,12 @@ module Phlex
38
42
  output = view_context.capture(*args, &block)
39
43
  end
40
44
 
41
- unchanged = (original_length == @_target.length)
45
+ unchanged = (original_length == @_context.target.length)
42
46
 
43
47
  if unchanged
44
48
  case output
45
49
  when ActiveSupport::SafeBuffer
46
- @_target << output
50
+ @_context.target << output
47
51
  end
48
52
  end
49
53
  end.html_safe
@@ -59,7 +63,7 @@ module Phlex
59
63
  def plain(content)
60
64
  case content
61
65
  when ActiveSupport::SafeBuffer
62
- @_target << content
66
+ @_context.target << content
63
67
  else
64
68
  super
65
69
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlex
4
4
  module Rails
5
- VERSION = "0.8.0"
5
+ VERSION = "0.9.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-06 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '1.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement