diff --git a/lib/phlex/kit.rb b/lib/phlex/kit.rb index e5d23a9e..7a13da3a 100644 --- a/lib/phlex/kit.rb +++ b/lib/phlex/kit.rb @@ -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) @@ -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