phlex 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of phlex might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e074c926f013d613e2523b41c8dd604758d087c64d377b50a343c651b0164c0d
4
- data.tar.gz: 56019e811dff06ef053adfeb20160fe29c247ee2e2f37848eba1580d240c41fd
3
+ metadata.gz: 8eeaf45425023ac13320c99f80956f12ec994395b3d349fc6a443334a6715b6d
4
+ data.tar.gz: 34672ca973f3bec7ade7cccae08e65fff009b122c5319345dadabf779877269e
5
5
  SHA512:
6
- metadata.gz: 24489ae7f67415aa23ce258d6a121fe37418ce32e543888410b730821feeafd5fda6f164dd6f390f9dd4a0ec7a8a92ae5c50deb53376f95f987203ad4da2acf2
7
- data.tar.gz: 1ddfa0b6dff09c597cec5f77f521faf89344981e4f3ddd3237722d94cb4d4faeec0d385a7ef4a0a18acec770d7f22811ac489ae94dfdfc3fc92fbf1cbb676f20
6
+ metadata.gz: 51d8f8bea886016a71b67a6b29b1b584dc1a95b29c4ac9cc24263a3e94be534e1ddfa89f800c10caf00618f27508828f9fc1b233b2829d0c1016aa484b0db6fc
7
+ data.tar.gz: 3cf6631189545652f860ec393fb63cf392bedd326271ee0863238a32f213a4704a7505442d4bbd06c7473e036c0dfb31c1f25584615189d801dc2515a25e4799
data/README.md CHANGED
@@ -14,6 +14,12 @@ If you run into any trouble, please [start a discussion](https://github.com/joel
14
14
 
15
15
  Everyone interacting in Phlex codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/joeldrapper/phlex/blob/main/CODE_OF_CONDUCT.md).
16
16
 
17
+ ### Who uses Phlex?
18
+
19
+ - [Clearscope](https://www.clearscope.io)
20
+
21
+ *If you can share that your company uses Phlex in production, please open a PR to list it here.*
22
+
17
23
  ### Sponsorship 💖
18
24
 
19
25
  Maintaining a library is a lot of work. If your company benefits from this work or is likely to benefit from it in the future, please consider [sponsorship](https://github.com/sponsors/joeldrapper). Phlex is actively developed and maintained by **[Joel Drapper](https://github.com/sponsors/joeldrapper)**.
@@ -25,3 +31,14 @@ If you’ve found a potential security issue, please email [security@phlex.fun](
25
31
  ### Thanks 🙏
26
32
 
27
33
  Thanks [Logology](https://www.logology.co) for sponsoring our logo.
34
+
35
+ ### Prior Art 🎨
36
+
37
+ - [markaby](https://github.com/markaby/markaby)
38
+ - [erector](https://github.com/erector/erector)
39
+ - [papercraft](https://github.com/digital-fabric/papercraft)
40
+ - [matestack](https://github.com/matestack/matestack-ui-core)
41
+ - [arbre](https://github.com/activeadmin/arbre)
42
+ - [tubby](https://github.com/judofyr/tubby)
43
+ - [hoshi](https://github.com/pete/hoshi)
44
+ - [hyperstack](https://github.com/hyperstack-org/hyperstack)
data/lib/phlex/html.rb CHANGED
@@ -134,12 +134,12 @@ module Phlex
134
134
  end
135
135
 
136
136
  def call(buffer = +"", view_context: nil, parent: nil, &block)
137
- return buffer unless render?
138
-
139
137
  @_target = buffer
140
138
  @_view_context = view_context
141
139
  @_parent = parent
142
140
 
141
+ return buffer unless render?
142
+
143
143
  around_template do
144
144
  if block_given?
145
145
  template do |*args|
@@ -154,7 +154,7 @@ module Phlex
154
154
  end
155
155
  end
156
156
 
157
- self.class.rendered_at_least_once ||= true
157
+ self.class.rendered_at_least_once = true
158
158
 
159
159
  buffer
160
160
  end
@@ -224,8 +224,9 @@ module Phlex
224
224
  end
225
225
 
226
226
  def unsafe_raw(content = nil, &block)
227
- @_target << (content || instance_exec(&block))
228
- nil
227
+ return nil unless content
228
+
229
+ @_target << content
229
230
  end
230
231
 
231
232
  def capture(&block)
@@ -353,7 +354,14 @@ module Phlex
353
354
  when Symbol
354
355
  buffer << " " << name << '="' << ERB::Util.html_escape(v.name) << '"'
355
356
  when Hash
356
- _build_attributes(v.transform_keys { "#{k}-#{_1.name.tr('_', '-')}" }, buffer: buffer)
357
+ _build_attributes(
358
+ v.transform_keys { |subkey|
359
+ case subkey
360
+ when Symbol then"#{k}-#{subkey.name.tr('_', '-')}"
361
+ else "#{k}-#{subkey}"
362
+ end
363
+ }, buffer: buffer
364
+ )
357
365
  else
358
366
  buffer << " " << name << '="' << ERB::Util.html_escape(v.to_s) << '"'
359
367
  end
data/lib/phlex/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlex
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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: 2022-12-08 00:00:00.000000000 Z
11
+ date: 2023-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk