Class: Expire::GenerateBackupListService
- Inherits:
-
Object
- Object
- Expire::GenerateBackupListService
- Defined in:
- lib/expire/generate_backup_list_service.rb
Overview
Reads contents of a directory and returns a corresponding BackupList
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(path) ⇒ GenerateBackupListService
constructor
A new instance of GenerateBackupListService.
Constructor Details
#initialize(path) ⇒ GenerateBackupListService
Returns a new instance of GenerateBackupListService.
10 11 12 |
# File 'lib/expire/generate_backup_list_service.rb', line 10 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
14 15 16 |
# File 'lib/expire/generate_backup_list_service.rb', line 14 def path @path end |
Class Method Details
.call(path) ⇒ Object
6 7 8 |
# File 'lib/expire/generate_backup_list_service.rb', line 6 def self.call(path) new(path).call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/expire/generate_backup_list_service.rb', line 16 def call if path == "-" generate_backup_list_from($stdin) else pathname = Pathname.new(path) raise InvalidPathError, "#{pathname} does not exit" unless pathname.exist? generate_backup_list_from(pathname.children) end end |