Skip to content

Commit

Permalink
Fiz Zeitwerk reloading (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper authored Oct 2, 2024
1 parent afafc0e commit 623bbcc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/phlex/kit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def const_added(name)
if Class === constant && constant < Phlex::SGML
constant.include(self)

constant = nil

define_method(name) do |*args, **kwargs, &block|
constant = me.const_get(name)
render(constant.new(*args, **kwargs), &block)
Expand All @@ -60,6 +62,7 @@ def const_added(name)
define_singleton_method(name) do |*args, **kwargs, &block|
if (component = Fiber[:__phlex_component__])
component.instance_exec do
constant = me.const_get(name)
render(constant.new(*args, **kwargs), &block)
end
else
Expand Down

0 comments on commit 623bbcc

Please sign in to comment.