Skip to content

Commit 9df8a87

Browse files
Fix modifiers inheritance issue
There seems to be loading issues with the `inherited` hook. This has been reported as not being an issue with this commit's code.
1 parent ec09533 commit 9df8a87

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

lib/phlexy_ui/base.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ def initialize(*base_modifiers, **options)
88
end
99

1010
class << self
11-
attr_reader :modifiers
12-
13-
private
11+
def modifiers
12+
@modifiers ||= {}
1413

15-
def inherited(subclass)
16-
super
17-
subclass.instance_variable_set(:@modifiers, (@modifiers || {}).dup)
14+
if superclass.respond_to?(:modifiers, true)
15+
superclass.send(:modifiers).merge(@modifiers)
16+
else
17+
@modifiers
18+
end
1819
end
1920

21+
private
22+
2023
def register_modifiers(modifiers)
2124
@modifiers ||= {}
2225
@modifiers.merge!(modifiers)

0 commit comments

Comments
 (0)