Class: RedmineExtensions::PatchManager::EasyPatchesCollection
- Includes:
- Comparable, Enumerable
- Defined in:
- lib/redmine_extensions/patch_manager.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #original_klass_to_patch)
readonly
Returns the value of attribute name.
-
#order ⇒ Object
Returns the value of attribute order.
-
#patches ⇒ Object
readonly
Returns the value of attribute patches.
Instance Method Summary collapse
- #<<(ep) ⇒ Object
- #<=>(other) ⇒ Object
- #apply_all_patches ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(name, order = nil) ⇒ EasyPatchesCollection
constructor
A new instance of EasyPatchesCollection.
Constructor Details
#initialize(name, order = nil) ⇒ EasyPatchesCollection
Returns a new instance of EasyPatchesCollection.
321 322 323 324 325 |
# File 'lib/redmine_extensions/patch_manager.rb', line 321 def initialize(name, order = nil) @name = name @patches = [] @order = order || 0 end |
Instance Attribute Details
#name ⇒ Object (readonly) Also known as: original_klass_to_patch
Returns the value of attribute name.
318 319 320 |
# File 'lib/redmine_extensions/patch_manager.rb', line 318 def name @name end |
#order ⇒ Object
Returns the value of attribute order.
319 320 321 |
# File 'lib/redmine_extensions/patch_manager.rb', line 319 def order @order end |
#patches ⇒ Object (readonly)
Returns the value of attribute patches.
318 319 320 |
# File 'lib/redmine_extensions/patch_manager.rb', line 318 def patches @patches end |
Instance Method Details
#<<(ep) ⇒ Object
347 348 349 350 |
# File 'lib/redmine_extensions/patch_manager.rb', line 347 def <<(ep) raise ArgumentError, 'patch class have to be a EasyPatch!' unless ep.is_a?(EasyPatch) @patches << ep end |
#<=>(other) ⇒ Object
352 353 354 |
# File 'lib/redmine_extensions/patch_manager.rb', line 352 def <=> other self.order <=> other.order end |
#apply_all_patches ⇒ Object
329 330 331 332 333 |
# File 'lib/redmine_extensions/patch_manager.rb', line 329 def apply_all_patches @patches.each do |ep| ep.apply_patch end end |
#each(&block) ⇒ Object
335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/redmine_extensions/patch_manager.rb', line 335 def each(&block) @patches.each do |patch| if block_given? block.call patch else yield patch end end end |