Skip to content

Commit

Permalink
Look up constant on read
Browse files Browse the repository at this point in the history
Required to support autoloading for some reason
  • Loading branch information
joeldrapper committed Sep 10, 2024
1 parent 16196ee commit 5b30b01
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/phlex/kit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ def __get_phlex_kit_constant__(name)
def const_added(name)
return if autoload?(name)

me = self
constant = const_get(name)

if Class === constant && constant < Phlex::SGML
constant.include(self)

define_method(name) do |*args, **kwargs, &block|
constant = me.const_get(name)
render(constant.new(*args, **kwargs), &block)
end

Expand Down

0 comments on commit 5b30b01

Please sign in to comment.