inline_partial 0.1.0 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/lib/inline_partial/helper.rb +2 -2
- data/lib/inline_partial/version.rb +1 -1
- data/sig/inline_partial.rbs +3 -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: cf589099fdc68511ac7d1e64ac5492ad210099aa6604af9c4ee8d49f3d6a6f73
|
4
|
+
data.tar.gz: b9a405ca7894b06eb720d3f730f6a16dfa5e2bd118ea2c83a03115335633a484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f39cfa31235ed73a17dc8cb14400fdf095a06b52ce1a86f85133dd964598feb4ec227f9f77c848ba5db071bda26aad25caa138e69dc7e29e152c51322d23b94
|
7
|
+
data.tar.gz: '0218cffaa9da21814eeb1606784ff6108b211b24b94717bf596db14f5156d47ac7237e3c221fd53732bb4447fd6d11c5448a26d8d3388d59080976bd33c1d83e'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
- No changes yet.
|
4
|
+
|
5
|
+
## [0.1.2] - 2025-06-28
|
6
|
+
|
7
|
+
- Update README to emphasize that partial templates can be defined with **any name**
|
8
|
+
- Clarify README and RBS documentation for inline_partial usage and parameters
|
9
|
+
|
10
|
+
## [0.1.1] - 2025-06-28
|
11
|
+
|
12
|
+
- Second release of inline_partial gem.
|
13
|
+
- Refactored `render_inline_partial` method to use explicit object parameter instead of `*args`.
|
14
|
+
|
3
15
|
## [0.1.0] - 2025-06-28
|
4
16
|
|
5
17
|
- Initial release
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ You can define a reusable ERB partial directly in your view:
|
|
22
22
|
<%= render_inline_partial :foo %>
|
23
23
|
```
|
24
24
|
|
25
|
-
This example defines a partial template named
|
25
|
+
This example defines a partial template named `:user_row`. You can define inline partials with **any name**, using either a **symbol** or a **string**.
|
26
26
|
|
27
27
|
```erb
|
28
28
|
<% inline_partial(:user_row) do |user| %>
|
@@ -10,7 +10,7 @@ module InlinePartial
|
|
10
10
|
nil
|
11
11
|
end
|
12
12
|
|
13
|
-
def render_inline_partial(name,
|
13
|
+
def render_inline_partial(name, object = nil, collection: nil)
|
14
14
|
raise ArgumentError, "partial name must be present (not nil)" if name.nil?
|
15
15
|
|
16
16
|
if collection
|
@@ -21,7 +21,7 @@ module InlinePartial
|
|
21
21
|
partial = @_inline_partials&.[](name)
|
22
22
|
raise ArgumentError, "inline partial :#{name.inspect} not found" unless partial
|
23
23
|
|
24
|
-
capture(
|
24
|
+
capture(object, &partial)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/sig/inline_partial.rbs
CHANGED
@@ -3,10 +3,10 @@ module InlinePartial
|
|
3
3
|
|
4
4
|
module Helper
|
5
5
|
# パーシャルの定義(ブロック必須)
|
6
|
-
def inline_partial: ((Symbol | String)
|
6
|
+
def inline_partial: ((Symbol | String), { (*untyped) -> untyped }) -> nil
|
7
7
|
|
8
|
-
# collection
|
9
|
-
def render_inline_partial: (Symbol | String,
|
8
|
+
# objectパラメータとcollectionキーワード引数に対応
|
9
|
+
def render_inline_partial: ((Symbol | String), ?untyped, ?collection: untyped) -> untyped
|
10
10
|
end
|
11
11
|
|
12
12
|
class Railtie < Rails::Railtie
|