Class: SnapshotArchive::Archives::Builder
- Inherits:
-
Object
- Object
- SnapshotArchive::Archives::Builder
- Defined in:
- lib/snapshot_archive/archives.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#stores ⇒ Object
readonly
Returns the value of attribute stores.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(dir, stores, id) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(dir, stores, id) ⇒ Builder
Returns a new instance of Builder.
9 10 11 12 13 |
# File 'lib/snapshot_archive/archives.rb', line 9 def initialize(dir, stores, id) @dir = dir @stores = stores @id = id end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
8 9 10 |
# File 'lib/snapshot_archive/archives.rb', line 8 def dir @dir end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/snapshot_archive/archives.rb', line 8 def id @id end |
#stores ⇒ Object (readonly)
Returns the value of attribute stores.
8 9 10 |
# File 'lib/snapshot_archive/archives.rb', line 8 def stores @stores end |
Class Method Details
.call(dir:, stores:, id:) ⇒ Object
4 5 6 |
# File 'lib/snapshot_archive/archives.rb', line 4 def self.call(dir:, stores:, id:) new(dir, stores, id).call end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/snapshot_archive/archives.rb', line 15 def call = ( stores .map { |name, store| File .join(dir, name) .tap { FileUtils.mkdir(_1) } .then { store.backup(dir: _1, id: id, name: name)&.merge(type: name) } } .compact ) { stores: } end |