Class: ReleaseWindow
- Inherits:
-
Object
- Object
- ReleaseWindow
- Defined in:
- lib/release_window.rb
Instance Method Summary collapse
- #all_releases ⇒ Object
- #current_window ⇒ Object
- #deletable_files ⇒ Object
- #deletable_releases ⇒ Object
-
#initialize(releases_path, releases, window = 5, matcher = '*') ⇒ ReleaseWindow
constructor
A new instance of ReleaseWindow.
Constructor Details
#initialize(releases_path, releases, window = 5, matcher = '*') ⇒ ReleaseWindow
Returns a new instance of ReleaseWindow.
3 4 5 6 7 8 |
# File 'lib/release_window.rb', line 3 def initialize releases_path, releases, window = 5, matcher = '*' @matcher = matcher @releases_path = releases_path @releases = releases.compact @window = window end |
Instance Method Details
#all_releases ⇒ Object
10 11 12 13 14 |
# File 'lib/release_window.rb', line 10 def all_releases Dir[@releases_path + @matcher].map do |r| File.basename(r) end.compact end |
#current_window ⇒ Object
20 21 22 |
# File 'lib/release_window.rb', line 20 def current_window @releases.last(@window) end |
#deletable_files ⇒ Object
24 25 26 27 28 |
# File 'lib/release_window.rb', line 24 def deletable_files deletable_releases.map do |r| "#{@releases_path}#{r}" end end |
#deletable_releases ⇒ Object
16 17 18 |
# File 'lib/release_window.rb', line 16 def deletable_releases all_releases - current_window end |