Class: RedmineExtensions::PatchManager::EasyPatchesCollection

Inherits:
Object
  • Object
show all
Includes:
Comparable, Enumerable
Defined in:
lib/redmine_extensions/patch_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, order = nil) ⇒ EasyPatchesCollection

Returns a new instance of EasyPatchesCollection.



317
318
319
320
321
# File 'lib/redmine_extensions/patch_manager.rb', line 317

def initialize(name, order = nil)
  @name = name
  @patches = []
  @order = order || 0
end

Instance Attribute Details

#nameObject (readonly) Also known as: original_klass_to_patch

Returns the value of attribute name.



314
315
316
# File 'lib/redmine_extensions/patch_manager.rb', line 314

def name
  @name
end

#orderObject

Returns the value of attribute order.



315
316
317
# File 'lib/redmine_extensions/patch_manager.rb', line 315

def order
  @order
end

#patchesObject (readonly)

Returns the value of attribute patches.



314
315
316
# File 'lib/redmine_extensions/patch_manager.rb', line 314

def patches
  @patches
end

Instance Method Details

#<<(ep) ⇒ Object

Raises:

  • (ArgumentError)


339
340
341
342
# File 'lib/redmine_extensions/patch_manager.rb', line 339

def <<(ep)
  raise ArgumentError, 'patch class have to be a EasyPatch!' unless ep.is_a?(EasyPatch)
  @patches << ep
end

#<=>(other) ⇒ Object



344
345
346
# File 'lib/redmine_extensions/patch_manager.rb', line 344

def <=> other
  self.order <=> other.order
end

#apply_all_patchesObject



325
326
327
328
329
# File 'lib/redmine_extensions/patch_manager.rb', line 325

def apply_all_patches
  @patches.each do |ep|
    ep.apply_patch
  end
end

#each(&block) ⇒ Object



331
332
333
334
335
336
337
# File 'lib/redmine_extensions/patch_manager.rb', line 331

def each(&block)

  @patches.each do |patch|
    yield patch
  end

end