Module: T::Props::Decorator::Private

Defined in:
lib/types/props/decorator.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).



816
817
818
819
820
821
822
# File 'lib/types/props/decorator.rb', line 816

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) # rubocop:disable PrisonGuard/NoDynamicConstAccess
  end
end

.apply_decorator_methods(plugin, target) ⇒ Object



824
825
826
827
828
829
830
# File 'lib/types/props/decorator.rb', line 824

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) # rubocop:disable PrisonGuard/NoDynamicConstAccess
  end
end