Class: RedmineExtensions::PatchManager::EasyPatch
- Defined in:
- lib/redmine_extensions/patch_manager.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#original_klass_to_patch ⇒ Object
Returns the value of attribute original_klass_to_patch.
-
#patching_module ⇒ Object
Returns the value of attribute patching_module.
Class Method Summary collapse
Instance Method Summary collapse
- #all_patching_modules ⇒ Object
- #apply_patch ⇒ Object
-
#initialize(original_klass_to_patch, patching_module, options = {}) ⇒ EasyPatch
constructor
A new instance of EasyPatch.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(original_klass_to_patch, patching_module, options = {}) ⇒ EasyPatch
Returns a new instance of EasyPatch.
334 335 336 337 |
# File 'lib/redmine_extensions/patch_manager.rb', line 334 def initialize(original_klass_to_patch, patching_module, = {}) @original_klass_to_patch, @patching_module, @options = original_klass_to_patch, patching_module, all_patching_modules << patching_module end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
332 333 334 |
# File 'lib/redmine_extensions/patch_manager.rb', line 332 def @options end |
#original_klass_to_patch ⇒ Object
Returns the value of attribute original_klass_to_patch.
332 333 334 |
# File 'lib/redmine_extensions/patch_manager.rb', line 332 def original_klass_to_patch @original_klass_to_patch end |
#patching_module ⇒ Object
Returns the value of attribute patching_module.
332 333 334 |
# File 'lib/redmine_extensions/patch_manager.rb', line 332 def patching_module @patching_module end |
Class Method Details
.all_patching_modules ⇒ Object
324 325 326 |
# File 'lib/redmine_extensions/patch_manager.rb', line 324 def self.all_patching_modules @@all_patching_modules ||= [] end |
Instance Method Details
#all_patching_modules ⇒ Object
328 329 330 |
# File 'lib/redmine_extensions/patch_manager.rb', line 328 def all_patching_modules self.class.all_patching_modules end |
#apply_patch ⇒ Object
347 348 349 350 351 352 353 354 355 356 |
# File 'lib/redmine_extensions/patch_manager.rb', line 347 def apply_patch if (cond = @options.delete(:if)) && cond.respond_to?(:call) return unless cond.call end pm_klass = patching_module.constantize oktp_klass = original_klass_to_patch.constantize oktp_klass.send(:include, pm_klass) # unless oktp_klass.include?(pm_klass) end |
#inspect ⇒ Object
343 344 345 |
# File 'lib/redmine_extensions/patch_manager.rb', line 343 def inspect to_s end |
#to_s ⇒ Object
339 340 341 |
# File 'lib/redmine_extensions/patch_manager.rb', line 339 def to_s "#{@original_klass_to_patch} <= #{@patching_module}" end |