Module: Ocs::Document::Patches

Defined in:
lib/ocs/document/generator.rb,
lib/ocs/document/patches/ocs/resources/base.rb

Defined Under Namespace

Modules: Ocs

Class Method Summary collapse

Class Method Details

.patch(target_class_path) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/ocs/document/generator.rb', line 87

def patch(target_class_path)
  patch_class_path  = "ocs/document/patches/#{target_class_path}"
  require target_class_path
  require patch_class_path
  target_class = target_class_path.camelize.constantize
  patch_class  = patch_class_path.camelize.constantize
  target_class.prepend(patch_class)
  if patch_class.const_defined?(:ClassMethods)
    target_class.singleton_class.instance_eval { self.prepend(patch_class::ClassMethods) }
  end
end