1
1
module ClassVariants
2
2
class Instance
3
- attr_reader :base , :variants , :compoundVariants , :defaults
3
+ attr_reader :base , :variants , :compound_variants , :defaults
4
4
5
5
# rubocop:disable Naming/VariableName
6
- def initialize ( classes = nil , base : nil , variants : { } , compoundVariants : [ ] , defaults : { } )
6
+ def initialize ( classes = nil , base : nil , variants : { } , compoundVariants : [ ] , compound_variants : [ ] , defaults : { } )
7
7
warn <<~MSG if classes
8
8
(ClassVariants) DEPRECATION WARNING: Use of positional argument for default classes is deprecated
9
9
and will be removed in the next version. Use the `base` keyword argument instead.
10
10
MSG
11
11
12
+ warn <<~MSG unless compoundVariants . empty?
13
+ (ClassVariants) DEPRECATION WARNING: Use of `compoundVariants` keyword argument is deprecated
14
+ and will be removed in the next version. Use the `compound_variant` instead.
15
+ MSG
16
+
12
17
@base = base || classes
13
18
@variants = expand_boolean_variants ( variants )
14
- @compoundVariants = compoundVariants
19
+ @compound_variants = compound_variants . empty? ? compoundVariants : compound_variants
15
20
@defaults = defaults
16
21
end
17
22
# rubocop:enable Naming/VariableName
@@ -28,7 +33,7 @@ def render(**overrides)
28
33
result << @variants . dig ( variant_type , variant )
29
34
end
30
35
31
- @compoundVariants . each do |compound_variant |
36
+ @compound_variants . each do |compound_variant |
32
37
if ( compound_variant . keys - [ :class ] ) . all? { |key | selected [ key ] == compound_variant [ key ] }
33
38
result << compound_variant [ :class ]
34
39
end
0 commit comments