Class: ActiveRecord::Snapshot::Snapshot
- Inherits:
-
Object
- Object
- ActiveRecord::Snapshot::Snapshot
- Defined in:
- lib/active_record/snapshot/files/snapshot.rb
Instance Method Summary collapse
- #compressed ⇒ Object
- #download ⇒ Object
- #dump ⇒ Object
- #encrypted ⇒ Object
-
#initialize(filename = nil) ⇒ Snapshot
constructor
A new instance of Snapshot.
- #named? ⇒ Boolean
- #upload ⇒ Object
Constructor Details
#initialize(filename = nil) ⇒ Snapshot
Returns a new instance of Snapshot.
4 5 6 7 8 |
# File 'lib/active_record/snapshot/files/snapshot.rb', line 4 def initialize(filename = nil) @filename = clean(filename) || dump_file directory = named? ? paths.named_snapshots : paths.snapshots @s3 = S3.new(directory: directory) end |
Instance Method Details
#compressed ⇒ Object
18 19 20 |
# File 'lib/active_record/snapshot/files/snapshot.rb', line 18 def compressed @filename + ".bz2" end |
#download ⇒ Object
30 31 32 |
# File 'lib/active_record/snapshot/files/snapshot.rb', line 30 def download s3.download_to(encrypted) end |
#dump ⇒ Object
14 15 16 |
# File 'lib/active_record/snapshot/files/snapshot.rb', line 14 def dump @filename end |
#encrypted ⇒ Object
22 23 24 |
# File 'lib/active_record/snapshot/files/snapshot.rb', line 22 def encrypted compressed + ".enc" end |
#named? ⇒ Boolean
10 11 12 |
# File 'lib/active_record/snapshot/files/snapshot.rb', line 10 def named? /\Asnapshot_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}(\..+)?\z/ !~ File.basename(@filename) end |
#upload ⇒ Object
26 27 28 |
# File 'lib/active_record/snapshot/files/snapshot.rb', line 26 def upload s3.upload(encrypted) end |