lib/arql/ext/object.rb in arql-0.3.31 vs lib/arql/ext/object.rb in arql-0.4.0

- old
+ new

@@ -17,6 +17,20 @@ end def a [self] end + + class << self + def const_missing(name) + return super unless const_defined?(:Arql) + return super unless Arql.const_defined?(:App) + return super unless Arql::App.instance&.definitions&.present? + + Arql::App.instance.definitions.lazy.filter do |_, definition| + definition.namespace_module.const_defined?(name) + end.map do |_, definition| + definition.namespace_module.const_get(name) + end.first || super + end + end end