Module: Qt::GeneratedSingletonForwardersRuntime

Defined in:
lib/qt/generated_singleton_forwarders_runtime.rb

Class Method Summary collapse

Class Method Details

.apply!(qt_module) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/qt/generated_singleton_forwarders_runtime.rb', line 7

def apply!(qt_module)
  qt_module.constants(false).each do |const_name|
    klass = qt_module.const_get(const_name, false)
    next unless klass.is_a?(Class)
    next unless klass.const_defined?(:QT_API_SINGLETON_FORWARDERS, false)

    klass.const_get(:QT_API_SINGLETON_FORWARDERS, false).each do |method_name|
      next if klass.instance_methods(false).include?(method_name.to_sym)
      next if klass.private_instance_methods(false).include?(method_name.to_sym)

      klass.send(:define_method, method_name) do |*args, &block|
        self.class.public_send(method_name, *args, &block)
      end
    end
  end
end