slotify 0.0.2 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0623930b397a09cafd4f47da222d46595e013da9987ee1491be5c501689e095
4
- data.tar.gz: 29f4f8d8427932b1bf85ed6205262e2dbe8196281951bec74042b2f35967928c
3
+ metadata.gz: 311b3b7001fb194c8518283b714ed8f5ed5990dc5b7fa51af34a25348f00d8cd
4
+ data.tar.gz: d22c0b5cea41b792e837f387b6c444013ff64013b84bcf781aa67f46e91a9e6c
5
5
  SHA512:
6
- metadata.gz: b14613a0d5522daf91565b60860c24df657a67807751034aab3a91d70888edeb0bcf381120e958fd42d9cf04290cc7b65964b913ea6a66339d6e375922109608
7
- data.tar.gz: 754d99784a31195603eaa9a4c9e91dc4cf4575e7987f181163ff6062251cfe50c7af5ff75f2133f552d7b57aaedc327e43c5d0fe74253964528503ea7fa54404
6
+ metadata.gz: 8cb049942e918fb670d775d9e7e6fe42a4db1b799d6df34a4ed7ea6dbb6f325824d52a56f629d379597e8273b3c02d6151749e6de01d7019def944b627bbc828
7
+ data.tar.gz: 70658ea93b6b19b14a0a608e6d3afc9e815a9f3c70fdfdd7a9d5ec20a9743b4fcb3603e6c2973381e7219cf4b39dd65e42448be5874446780a8c020055923061
data/README.md CHANGED
@@ -269,11 +269,11 @@ When rendered as a string the options are passed through the Rails `tag.attribut
269
269
  There are two types of slots.
270
270
 
271
271
  * **Single-value** slots can only be called **once** and return **a single value**.
272
- * **Multiple-value** slots can be called **many times** and return **an array of values**.
272
+ * **Multi-value** slots can be called **many times** and return **an array of values**.
273
273
 
274
274
  #### Single-value slots
275
275
 
276
- Single-value slots are defined using a **singlular** slot name:
276
+ Single-value slots are defined using a **singular** slot name:
277
277
 
278
278
  ```erb
279
279
  <%# slots: (item: nil) -%>
@@ -305,18 +305,18 @@ and their corresponding template variable represents a single value:
305
305
  > <% end %>
306
306
  > ```
307
307
 
308
- #### Multiple-value slots
308
+ #### Multi-value slots
309
309
 
310
- Multiple-value slots are defined using a **plural** slot name:
310
+ Multi-value slots are defined using a **plural** slot name:
311
311
 
312
312
  ```erb
313
313
  <%# slots: (items: nil) -%>
314
314
  ```
315
315
 
316
- Multiple-value slots can be called as many times as needed
316
+ Multi-value slots can be called as many times as needed
317
317
  and their corresponding template variable represents an array of values.
318
318
 
319
- The slot writer methods for multiple-value slots use the **singluar form** of the slot name (e.g. `#with_item` for the `items` slot).
319
+ The slot writer methods for multi-value slots use the **singluar form** of the slot name (e.g. `#with_item` for the `items` slot).
320
320
 
321
321
  ```erb
322
322
  <%= render "example" do |partial| %>
@@ -371,8 +371,6 @@ The slot writer methods for multiple-value slots use the **singluar form** of th
371
371
  **Singlular slot value variables** in partial templates are actually instances of `Slotity::Value`.
372
372
  These value objects are automatically stringified so in most cases you will not even be aware of this and they can just be treated as regular string variables.
373
373
 
374
-
375
-
376
374
  ```erb
377
375
  <%= render "example" do |partial| %>
378
376
  <% partial.with_title class: "color-hotpink" do %>
@@ -448,7 +446,7 @@ However there are a number of key differences:
448
446
  Nice partials slots are implicitly defined when rendering the partial.
449
447
  * Slotify slot values are available as local variables;
450
448
  with Nice partials slot values are accessed via methods on the `partial` variable.
451
- * Slotify has the concept (and enforces the use) of single-value vs. multiple-value slots.
449
+ * Slotify has the concept (and enforces the use) of single- vs. multi-value slots.
452
450
  * Slotify slot content and options are transparently expanded and merged into defaults when using with helpers like `content_tag` and `link_to`.
453
451
  * Slotify slot values are `renderable` objects
454
452
 
@@ -458,7 +456,7 @@ separation of 'nice partial' functionality from ActionView-provided locals etc.
458
456
  #### `view_component`
459
457
 
460
458
  Both [ViewComponent](https://viewcomponent.org/) and Slotify provide a 'slots' API for content blocks.
461
- Slotify's slot writer syntax (i.e. `.with_<slot_name>` methods) and the concept of single-value (`renders_one`) vs multiple-value (`renders_many`) slots
459
+ Slotify's slot writer syntax (i.e. `.with_<slot_name>` methods) and the concept of single-value (`renders_one`) vs multi-value (`renders_many`) slots
462
460
  are both modelled on ViewComponent's slots implementation.
463
461
 
464
462
  However apart from that they are quite different. Slotify adds functionality to regular ActionView partials whereas ViewComponent provides a complete standalone component system.
@@ -484,78 +482,99 @@ And then run `bundle install`. You are good to go!
484
482
  * `Rails 7.1+`
485
483
  * `Ruby 3.1+`
486
484
 
487
- ## Credits
485
+ ## Testing
488
486
 
489
- Slotify was inspired by the excellent [nice_partials gem](https://github.com/bullet-train-co/nice_partials) as well as ViewComponent's [slots implementation](https://viewcomponent.org/guide/slots.html).
487
+ Slotify uses MiniTest for its test suite.
488
+
489
+ [Appraisal](https://github.com/thoughtbot/appraisal) is used in CI to test against a matrix of Ruby/Rails versions.
490
490
 
491
- `nice_partials` provides very similar functionality to Slotify but takes a slightly different approach/style. So if you are not convinced by Slotify then definitely [check it out](https://github.com/bullet-train-co/nice_partials)!
491
+ #### Run tests
492
492
 
493
- ## Benchmarks
493
+ ```shell
494
+ bin/test
495
+ ```
494
496
 
495
- Slotify is still in the early stages of development and no attempt has yet been made to optimise rendering performance.
497
+ ### Benchmarks
496
498
 
497
- Below are some initial (crude) benchmarking comparisons with other similar gems.
499
+ Rendering performance benchmark tests for Slotify and a few alternatives (`action_view`, `view_component` & `nice_partials`) can be found in the `/performance` directory.
498
500
 
499
- > [!TIP]
500
- > Benchmarks can be run using the `bin/benchmarks` command from the repository root.
501
+ These benchmarks are a little crude right now!
502
+
503
+ **Run benchmarks:**
501
504
 
505
+ ```shell
506
+ bin/benchmarks # run all benchmarks
507
+ bin/benchmarks slotify # run Slotify benchmarks only
502
508
  ```
503
- ✨🦄 ACTION_VIEW 🦄✨
509
+
510
+ <details>
511
+ <summary>Recent benchmark results</summary>
512
+
513
+ ```
514
+ 🏁🏁 ACTION_VIEW 🏁🏁
504
515
 
505
516
  ruby 3.3.1 (2024-04-23 revision c56cd86388) [arm64-darwin23]
506
517
  Warming up --------------------------------------
507
- no slots 12.997k i/100ms
508
- slots 10.891k i/100ms
518
+ no slots 13.120k i/100ms
519
+ slots 11.038k i/100ms
509
520
  Calculating -------------------------------------
510
- no slots 125.622k (± 5.4%) i/s (7.96 μs/i) - 1.261M in 10.072521s
511
- slots 108.468k3.3%) i/s (9.22 μs/i) - 1.089M in 10.053026s
521
+ no slots 127.047k (± 5.2%) i/s (7.87 μs/i) - 1.273M in 10.051203s
522
+ slots 106.400k5.0%) i/s (9.40 μs/i) - 1.071M in 10.095061s
512
523
 
513
524
  Comparison:
514
- no slots: 125621.9 i/s
515
- slots: 108467.5 i/s - 1.16x slower
525
+ no slots: 127047.3 i/s
526
+ slots: 106400.3 i/s - 1.19x slower
516
527
 
517
528
 
518
- ✨🦄 NICE_PARTIALS 🦄✨
529
+ 🏁🏁 NICE_PARTIALS 🏁🏁
519
530
 
520
531
  ruby 3.3.1 (2024-04-23 revision c56cd86388) [arm64-darwin23]
521
532
  Warming up --------------------------------------
522
- no slots 11.822k i/100ms
523
- slots 4.204k i/100ms
533
+ no slots 11.451k i/100ms
534
+ slots 3.889k i/100ms
524
535
  Calculating -------------------------------------
525
- no slots 114.190k4.7%) i/s (8.76 μs/i) - 1.147M in 10.069870s
526
- slots 41.138k (± 4.3%) i/s (24.31 μs/i) - 411.992k in 10.039730s
536
+ no slots 117.258k3.3%) i/s (8.53 μs/i) - 1.179M in 10.070693s
537
+ slots 40.737k (± 4.5%) i/s (24.55 μs/i) - 408.345k in 10.051584s
527
538
 
528
539
  Comparison:
529
- no slots: 114190.2 i/s
530
- slots: 41137.9 i/s - 2.78x slower
540
+ no slots: 117257.7 i/s
541
+ slots: 40736.8 i/s - 2.88x slower
531
542
 
532
543
 
533
- ✨🦄 VIEW_COMPONENT 🦄✨
544
+ 🏁🏁 VIEW_COMPONENT 🏁🏁
534
545
 
535
546
  ruby 3.3.1 (2024-04-23 revision c56cd86388) [arm64-darwin23]
536
547
  Warming up --------------------------------------
537
- no slots 20.329k i/100ms
538
- slots 7.409k i/100ms
548
+ no slots 20.270k i/100ms
549
+ slots 7.445k i/100ms
539
550
  Calculating -------------------------------------
540
- no slots 196.288k4.7%) i/s (5.09 μs/i) - 1.972M in 10.073103s
541
- slots 71.311k (± 5.0%) i/s (14.02 μs/i) - 718.673k in 10.108426s
551
+ no slots 211.571k2.6%) i/s (4.73 μs/i) - 2.128M in 10.067334s
552
+ slots 72.508k (± 5.2%) i/s (13.79 μs/i) - 729.610k in 10.096809s
542
553
 
543
554
  Comparison:
544
- no slots: 196287.6 i/s
545
- slots: 71310.5 i/s - 2.75x slower
555
+ no slots: 211570.7 i/s
556
+ slots: 72508.0 i/s - 2.92x slower
546
557
 
547
558
 
548
- ✨🦄 SLOTIFY 🦄✨
559
+ 🏁🏁 SLOTIFY 🏁🏁
549
560
 
550
561
  ruby 3.3.1 (2024-04-23 revision c56cd86388) [arm64-darwin23]
551
562
  Warming up --------------------------------------
552
- no slots 10.883k i/100ms
553
- slots 77.000 i/100ms
563
+ no slots 12.051k i/100ms
564
+ slots 2.710k i/100ms
554
565
  Calculating -------------------------------------
555
- no slots 110.153k (± 4.8%) i/s (9.08 μs/i) - 1.099M in 10.009002s
556
- slots 789.118 (± 4.1%) i/s (1.27 ms/i) - 7.931k in 10.071749s
566
+ no slots 116.156k5.4%) i/s (8.61 μs/i) - 1.169M in 10.102387s
567
+ slots 26.454k5.4%) i/s (37.80 μs/i) - 265.580k in 10.077285s
557
568
 
558
569
  Comparison:
559
- no slots: 110152.8 i/s
560
- slots: 789.1 i/s - 139.59x slower
570
+ no slots: 116155.7 i/s
571
+ slots: 26454.0 i/s - 4.39x slower
561
572
  ```
573
+
574
+ </details>
575
+
576
+ ## Credits
577
+
578
+ Slotify was inspired by the excellent [nice_partials gem](https://github.com/bullet-train-co/nice_partials) as well as ViewComponent's [slots implementation](https://viewcomponent.org/guide/slots.html).
579
+
580
+ `nice_partials` provides very similar functionality to Slotify but takes a slightly different approach/style. So if you are not convinced by Slotify then definitely [check it out](https://github.com/bullet-train-co/nice_partials)!
@@ -0,0 +1,19 @@
1
+ module Slotify
2
+ module SymbolInflectionHelper
3
+ extend ActiveSupport::Concern
4
+
5
+ mattr_accessor :singularizations, default: {}
6
+
7
+ def singular?(sym)
8
+ singularize(sym.to_sym) == sym.to_sym
9
+ end
10
+
11
+ def plural?(sym)
12
+ !singular?(sym)
13
+ end
14
+
15
+ def singularize(sym)
16
+ singularizations[sym.to_sym] ||= sym.to_s.singularize.to_sym
17
+ end
18
+ end
19
+ end
@@ -5,13 +5,6 @@ module Slotify
5
5
 
6
6
  attr_accessor :partial
7
7
 
8
- def render(options = {}, locals = {}, &block)
9
- @partial = Slotify::Partial.new(self)
10
- super
11
- ensure
12
- @partial = partial.outer_partial
13
- end
14
-
15
8
  def capture_with_outer_partial_access(*args, &block)
16
9
  inner_partial, @partial = partial, partial.outer_partial
17
10
  inner_partial.capture(*args, &block)
@@ -4,17 +4,20 @@ module Slotify
4
4
  def render_partial_template(view, locals, template, layout, block)
5
5
  return super unless template.strict_slots?
6
6
 
7
- view.partial.define_slots!(template.strict_slots_keys)
7
+ view.partial = Slotify::Partial.new(view, template.strict_slots_keys)
8
8
 
9
9
  view.capture_with_outer_partial_access(&block) if block
10
+
10
11
  locals = locals.merge(view.partial.slot_locals)
11
12
 
12
13
  decorate_strict_slots_errors do
13
14
  super(view, locals, template, layout, block)
14
15
  end
16
+ ensure
17
+ view.partial = view.partial.outer_partial if view.partial
15
18
  end
16
19
 
17
- def decorate_strict_slots_errors(&block)
20
+ def decorate_strict_slots_errors
18
21
  yield
19
22
  rescue ActionView::Template::Error => error
20
23
  if missing_strict_locals_error?(error)
@@ -31,7 +31,7 @@ module Slotify
31
31
  end
32
32
 
33
33
  def strict_slots_keys
34
- @strict_slots_keys ||= strict_slots!.scan(STRICT_SLOTS_KEYS_REGEX).map(&:first)
34
+ @strict_slots_keys ||= strict_slots!.scan(STRICT_SLOTS_KEYS_REGEX).map(&:first).freeze
35
35
  end
36
36
 
37
37
  def strict_locals!
@@ -44,7 +44,7 @@ module Slotify
44
44
  return super unless strict_slots?
45
45
 
46
46
  strict_slots_keys.each_with_object(+super) do |key, code|
47
- code << "partial.set_slot_default(:#{key}, binding.local_variable_get(:#{key})); #{key} = partial.public_send(:#{key});"
47
+ code << "partial.set_slot_default(:#{key}, binding.local_variable_get(:#{key})); #{key} = partial.content_for(:#{key});"
48
48
  end
49
49
  end
50
50
  end
@@ -1,6 +1,6 @@
1
1
  module Slotify
2
2
  class Partial
3
- include InflectionHelper
3
+ include SymbolInflectionHelper
4
4
 
5
5
  RESERVED_SLOT_NAMES = [
6
6
  :content, :slot, :value, :content_for,
@@ -9,11 +9,13 @@ module Slotify
9
9
 
10
10
  attr_reader :outer_partial
11
11
 
12
- def initialize(view_context)
12
+ def initialize(view_context, slots = [])
13
13
  @view_context = view_context
14
14
  @outer_partial = view_context.partial
15
15
  @values = ValueStore.new(@view_context)
16
16
  @defined_slots = nil
17
+
18
+ define_slots!(slots)
17
19
  end
18
20
 
19
21
  def content_for(slot_name)
@@ -50,8 +52,6 @@ module Slotify
50
52
  end
51
53
 
52
54
  def slot_locals
53
- validate_slots!
54
-
55
55
  pairs = @defined_slots.map do |slot_name|
56
56
  slot_values = values.for(slot_name)
57
57
  slot_values = singular?(slot_name) ? slot_values&.first : slot_values
@@ -65,50 +65,56 @@ module Slotify
65
65
  end.to_h
66
66
  end
67
67
 
68
- def define_slots!(slot_names)
69
- raise SlotsDefinedError, "Slots cannot be redefined" unless @defined_slots.nil?
68
+ private
70
69
 
70
+ attr_reader :values
71
+
72
+ def slot?(slot_name)
73
+ slot_name && @defined_slots.include?(slot_name.to_sym)
74
+ end
75
+
76
+ def define_slots!(slot_names)
71
77
  @defined_slots = slot_names.map(&:to_sym).each do |slot_name|
72
78
  if RESERVED_SLOT_NAMES.include?(singularize(slot_name))
73
- raise ReservedSlotNameError, ":#{slot_name} is a reserved word and cannot be used as a slot name"
79
+ raise ReservedSlotNameError,
80
+ ":#{slot_name} is a reserved word and cannot be used as a slot name"
74
81
  end
75
- end
76
- end
77
82
 
78
- def respond_to_missing?(name, include_private = false)
79
- name.start_with?("with_") || slot?(name)
80
- end
81
-
82
- def method_missing(name, *args, **options, &block)
83
- if name.start_with?("with_")
84
- values.add(name.to_s.delete_prefix("with_"), args, options, block)
85
- elsif slot?(name)
86
- content_for(name)
87
- else
88
- super
83
+ if singular?(slot_name)
84
+ define_single_value_slot_method(slot_name)
85
+ else
86
+ define_multi_value_slot_methods(slot_name)
87
+ end
89
88
  end
90
89
  end
91
90
 
92
- private
91
+ def define_single_value_slot_method(slot_name)
92
+ method_name = :"with_#{slot_name}"
93
93
 
94
- attr_reader :values
94
+ return if respond_to?(method_name)
95
95
 
96
- def slot?(slot_name)
97
- slot_name && @defined_slots.include?(slot_name.to_sym)
96
+ self.class.define_method(method_name) do |*args, **options, &block|
97
+ if values.for(slot_name).any?
98
+ raise MultipleSlotEntriesError,
99
+ "slot :#{slot_name} is defined as a single-value slot but was called multiple times"
100
+ end
101
+
102
+ values.add(slot_name, args, options, block)
103
+ end
98
104
  end
99
105
 
100
- def validate_slots!
101
- return if @defined_slots.nil?
106
+ def define_multi_value_slot_methods(slot_name)
107
+ method_name = :"with_#{slot_name}"
108
+ singular_slot_name = singularize(slot_name)
109
+
110
+ return if respond_to?(method_name)
102
111
 
103
- undefined_slots = values.slot_names - @defined_slots.map { singularize(_1) }
104
- if undefined_slots.any?
105
- raise UndefinedSlotError,
106
- "missing slot #{"definition".pluralize(undefined_slots.size)} for `#{undefined_slots.map { ":#{_1}(s)" }.join(", ")}`"
112
+ self.class.define_method(method_name) do |*args, **options, &block|
113
+ values.add(slot_name, args, options, block)
107
114
  end
108
115
 
109
- @defined_slots.filter { singular?(_1) }.each do |slot_name|
110
- slot_values = values.for(slot_name)
111
- raise MultipleSlotEntriesError, "slot :#{slot_name} called #{slot_values.size} times (expected 1)" if slot_values.many?
116
+ self.class.define_method(:"with_#{singular_slot_name}") do |*args, **options, &block|
117
+ values.add(singular_slot_name, args, options, block)
112
118
  end
113
119
  end
114
120
  end
@@ -1,53 +1,46 @@
1
1
  module Slotify
2
2
  module TagOptionsMerger
3
3
  class << self
4
- include ::ActionView::Helpers::TagHelper
5
-
6
4
  def call(original, target)
7
- original = original.to_h.deep_symbolize_keys
8
- target = target.to_h.deep_symbolize_keys
9
-
10
- target.each do |key, value|
11
- original[key] = case key
12
- when :data
13
- merge_data_options(original[key], value)
14
- when :class
15
- merge_class_options(original[key], value)
16
- else
17
- value
18
- end
19
- end
20
-
21
- original
5
+ mix(original, target)
22
6
  end
23
7
 
24
8
  private
25
9
 
26
- def merge_data_options(original_data, target_data)
27
- original_data = original_data.dup
10
+ # https://www.phlex.fun/sgml/helpers#mix
11
+ def mix(*args)
12
+ args.each_with_object({}) do |object, result|
13
+ result.merge!(object) do |_key, old, new|
14
+ case [old, new].freeze
15
+ in [Array, Array] | [Set, Set]
16
+ old + new
17
+ in [Array, Set]
18
+ old + new.to_a
19
+ in [Array, String]
20
+ old + [new]
21
+ in [Hash, Hash]
22
+ mix(old, new)
23
+ in [Set, Array]
24
+ old.to_a + new
25
+ in [Set, String]
26
+ old.to_a + [new]
27
+ in [String, Array]
28
+ [old] + new
29
+ in [String, Set]
30
+ [old] + new.to_a
31
+ in [String, String]
32
+ "#{old} #{new}"
33
+ in [_, nil]
34
+ old
35
+ else
36
+ new
37
+ end
38
+ end
28
39
 
29
- target_data.each do |key, value|
30
- values = [original_data[key], value]
31
- original_data[key] = if key.in?([:controller, :action]) && all_kind_of?(String, values)
32
- merge_strings(values)
33
- else
34
- value
40
+ result.transform_keys! do |key|
41
+ key.end_with?("!") ? key.name.chop.to_sym : key
35
42
  end
36
43
  end
37
-
38
- original_data
39
- end
40
-
41
- def merge_class_options(original_classes, target_classes)
42
- class_names(original_classes, target_classes)
43
- end
44
-
45
- def merge_strings(*args)
46
- args.map(&:presence).compact.join(" ")
47
- end
48
-
49
- def all_kind_of?(kind, values)
50
- values.none? { !_1.is_a?(kind) }
51
44
  end
52
45
  end
53
46
  end
data/lib/slotify/value.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Slotify
2
2
  class Value
3
- include InflectionHelper
3
+ include SymbolInflectionHelper
4
4
 
5
5
  attr_reader :slot_name, :args, :block
6
6
 
@@ -47,7 +47,7 @@ module Slotify
47
47
  alias_method :to_hash, :to_h
48
48
 
49
49
  def with_partial_path(partial_path)
50
- Value.new(@view_context, @args, options, @block, slot_name: @slot_name, partial_path:)
50
+ Value.new(@view_context, @args, @options, @block, slot_name: @slot_name, partial_path:)
51
51
  end
52
52
 
53
53
  def with_default_options(default_options)
@@ -61,7 +61,7 @@ module Slotify
61
61
 
62
62
  def method_missing(name, ...)
63
63
  if name.start_with?("to_")
64
- @args.first.public_send(name, ...)
64
+ content.public_send(name, ...)
65
65
  else
66
66
  super
67
67
  end
@@ -72,7 +72,7 @@ module Slotify
72
72
  end
73
73
 
74
74
  def render_in(view_context, &block)
75
- view_context.render partial_path, **@options.to_h, &@block || block
75
+ view_context.render partial_path, **@options.to_h, &block || @block
76
76
  end
77
77
 
78
78
  private
@@ -1,6 +1,6 @@
1
1
  module Slotify
2
2
  class ValueStore
3
- include InflectionHelper
3
+ include SymbolInflectionHelper
4
4
 
5
5
  def initialize(view_context)
6
6
  @view_context = view_context
@@ -13,11 +13,9 @@ module Slotify
13
13
 
14
14
  def add(slot_name, args = [], options = {}, block = nil)
15
15
  if plural?(slot_name)
16
- Array.wrap(args.first).map { add(singularize(slot_name), _1, options, block) }
16
+ Array.wrap(args.shift).map { add(singularize(slot_name), [_1, *args], options, block) }
17
17
  else
18
- MethodArgsResolver.call(args, options, block) do
19
- @values << Value.new(@view_context, _1, _2, _3, slot_name: singularize(slot_name))
20
- end
18
+ @values << Value.new(@view_context, args, options, block, slot_name: singularize(slot_name))
21
19
  end
22
20
  end
23
21
 
@@ -1,3 +1,3 @@
1
1
  module Slotify
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-13 00:00:00.000000000 Z
11
+ date: 2025-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -46,8 +46,8 @@ extra_rdoc_files: []
46
46
  files:
47
47
  - README.md
48
48
  - lib/slotify.rb
49
- - lib/slotify/concerns/inflection_helper.rb
50
49
  - lib/slotify/concerns/slot_compatability.rb
50
+ - lib/slotify/concerns/symbol_inflection_helper.rb
51
51
  - lib/slotify/error.rb
52
52
  - lib/slotify/extensions/base.rb
53
53
  - lib/slotify/extensions/partial_renderer.rb
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.3.3
82
+ rubygems_version: 3.5.10
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Superpowered slots for your Rails partials.
@@ -1,18 +0,0 @@
1
- module Slotify
2
- module InflectionHelper
3
- extend ActiveSupport::Concern
4
-
5
- def singular?(str)
6
- str = str.to_s
7
- str.singularize == str && str.pluralize != str
8
- end
9
-
10
- def singularize(sym)
11
- sym.to_s.singularize.to_sym
12
- end
13
-
14
- def plural?(str)
15
- !singular?(str)
16
- end
17
- end
18
- end