phlex-slotable 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +3 -1
- data/CHANGELOG.md +5 -0
- data/README.md +1 -0
- data/benchmark/main.rb +1 -0
- data/lib/phlex/slotable/version.rb +1 -1
- data/lib/phlex/slotable.rb +9 -3
- 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: 7ed2552d628d6851db0da87a5105818d55b5a28bda04d7b5dd9dc0f6fe7357a5
|
4
|
+
data.tar.gz: dd6b66cb419fae64ee1ea963670735a3773a6d1c26bf18c2cc1be01ad43e559b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aafc0d75f3907534255f8ffdc8800e8541373884c5e149afc12dfd5f1e811644c6f037ec32640501f8faec83dace3ea6368c6a17c51fe88b2e27557813f4b70
|
7
|
+
data.tar.gz: a5d11b19a175d1228c0ec7561986dbec0f0a976829b0b0300d599c15d32e801d9afcd4fd2dabdd3a180efccf2f12bde9673ee84744c712fa9aca7b77f3a8e412
|
data/.standard.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
> Please note that Phlex::Slotable is currently under development and may undergo changes to its API before reaching the stable release (1.0.0). As a result, there may be breaking changes that affect its usage.
|
3
3
|
|
4
4
|
# Phlex::Slotable
|
5
|
+
[![CI](https://github.com/stephannv/phlex-slotable/actions/workflows/main.yml/badge.svg)](https://github.com/stephannv/phlex-slotable/actions/workflows/main.yml)
|
5
6
|
|
6
7
|
Phlex::Slotable enables slots feature to [Phlex](https://www.phlex.fun/) views. Inspired by ViewComponent.
|
7
8
|
|
data/benchmark/main.rb
CHANGED
data/lib/phlex/slotable.rb
CHANGED
@@ -62,7 +62,9 @@ module Phlex
|
|
62
62
|
RUBY
|
63
63
|
else
|
64
64
|
<<-RUBY
|
65
|
-
def #{slot_name}_slot
|
65
|
+
def #{slot_name}_slot
|
66
|
+
@#{slot_name}_slot
|
67
|
+
end
|
66
68
|
private :#{slot_name}_slot
|
67
69
|
RUBY
|
68
70
|
end
|
@@ -73,12 +75,16 @@ module Phlex
|
|
73
75
|
def define_predicate_method(slot_name, many:)
|
74
76
|
predicate_method = if many
|
75
77
|
<<-RUBY
|
76
|
-
def #{slot_name}_slots?
|
78
|
+
def #{slot_name}_slots?
|
79
|
+
#{slot_name}_slots.any?
|
80
|
+
end
|
77
81
|
private :#{slot_name}_slots?
|
78
82
|
RUBY
|
79
83
|
else
|
80
84
|
<<-RUBY
|
81
|
-
def #{slot_name}_slot?
|
85
|
+
def #{slot_name}_slot?
|
86
|
+
!#{slot_name}_slot.nil?
|
87
|
+
end
|
82
88
|
private :#{slot_name}_slot?
|
83
89
|
RUBY
|
84
90
|
end
|