Class: Backup::Splitter
- Inherits:
-
Object
- Object
- Backup::Splitter
- Includes:
- Utilities::Helpers
- Defined in:
- lib/backup/splitter.rb
Instance Attribute Summary collapse
-
#chunk_size ⇒ Object
readonly
Returns the value of attribute chunk_size.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#suffix_length ⇒ Object
readonly
Returns the value of attribute suffix_length.
Instance Method Summary collapse
-
#initialize(model, chunk_size, suffix_length) ⇒ Splitter
constructor
A new instance of Splitter.
-
#split_with {|split_command| ... } ⇒ Object
This is called as part of the procedure used to build the final backup package file(s).
Constructor Details
#initialize(model, chunk_size, suffix_length) ⇒ Splitter
Returns a new instance of Splitter.
9 10 11 12 13 |
# File 'lib/backup/splitter.rb', line 9 def initialize(model, chunk_size, suffix_length) @package = model.package @chunk_size = chunk_size @suffix_length = suffix_length end |
Instance Attribute Details
#chunk_size ⇒ Object (readonly)
Returns the value of attribute chunk_size.
7 8 9 |
# File 'lib/backup/splitter.rb', line 7 def chunk_size @chunk_size end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
7 8 9 |
# File 'lib/backup/splitter.rb', line 7 def package @package end |
#suffix_length ⇒ Object (readonly)
Returns the value of attribute suffix_length.
7 8 9 |
# File 'lib/backup/splitter.rb', line 7 def suffix_length @suffix_length end |
Instance Method Details
#split_with {|split_command| ... } ⇒ Object
This is called as part of the procedure used to build the final backup package file(s). It yields it’s portion of the command line for this procedure, which will split the data being piped into it into multiple files, based on the @chunk_size, using a suffix length as specified by @suffix_length. Once the packaging procedure is complete, it will return and
23 24 25 26 27 28 |
# File 'lib/backup/splitter.rb', line 23 def split_with Logger.info "Splitter configured with a chunk size of #{ chunk_size }MB " + "and suffix length of #{ suffix_length }." yield split_command after_packaging end |