File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change
1
+ ## Unreleased
2
+ - Fix issue with inherited hook in helper ([ #33 ] ( https://github.com/avo-hq/class_variants/pull/33 ) )
3
+
1
4
## 1.1.0 (2025-01-20)
2
5
- Add support for merging ([ #23 ] ( https://github.com/avo-hq/class_variants/pull/23 ) )
3
6
- Add support for subclass inheritance in helper ([ #24 ] ( https://github.com/avo-hq/class_variants/pull/24 ) )
Original file line number Diff line number Diff line change @@ -11,9 +11,12 @@ def class_variants(...)
11
11
def self . included ( base )
12
12
base . extend ( ClassMethods )
13
13
base . singleton_class . instance_variable_set ( :@_class_variants_instance , ClassVariants ::Instance . new )
14
- base . define_singleton_method ( :inherited ) do |subclass |
14
+
15
+ def base . inherited ( subclass )
16
+ super if defined? ( super )
17
+
15
18
subclass . singleton_class . instance_variable_set (
16
- :@_class_variants_instance , base . singleton_class . instance_variable_get ( :@_class_variants_instance ) . dup
19
+ :@_class_variants_instance , singleton_class . instance_variable_get ( :@_class_variants_instance ) . dup
17
20
)
18
21
end
19
22
end
You can’t perform that action at this time.
0 commit comments