Module: T::Props::Plugin::Private

Defined in:
lib/types/props/plugin.rb

Class Method Summary collapse

Class Method Details

.apply_class_methods(plugin, target) ⇒ Object

These need to be non-instance methods so we can use them without prematurely creating the child decorator in ‘model_inherited` (see comments there for details).

The dynamic constant access below forces this file to be ‘typed: false`



21
22
23
24
25
26
27
# File 'lib/types/props/plugin.rb', line 21

def self.apply_class_methods(plugin, target)
  if plugin.const_defined?('ClassMethods')
    # FIXME: This will break preloading, selective test execution, etc if `mod::ClassMethods`
    # is ever defined in a separate file from `mod`.
    target.extend(plugin::ClassMethods)
  end
end

.apply_decorator_methods(plugin, target) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/types/props/plugin.rb', line 29

def self.apply_decorator_methods(plugin, target)
  if plugin.const_defined?('DecoratorMethods')
    # FIXME: This will break preloading, selective test execution, etc if `mod::DecoratorMethods`
    # is ever defined in a separate file from `mod`.
    target.extend(plugin::DecoratorMethods)
  end
end