Class: ActiveRecord::Snapshot::Version
- Inherits:
-
Object
- Object
- ActiveRecord::Snapshot::Version
- Defined in:
- lib/active_record/snapshot/files/version.rb
Class Method Summary collapse
- .current ⇒ Object
- .download ⇒ Object
- .filename ⇒ Object
- .increment ⇒ Object
- .next ⇒ Object
- .path ⇒ Object
- .upload ⇒ Object
- .write(version) ⇒ Object
Class Method Details
.current ⇒ Object
5 6 7 8 |
# File 'lib/active_record/snapshot/files/version.rb', line 5 def current return nil unless File.file?(path) ::File.read(path).to_i end |
.download ⇒ Object
23 24 25 |
# File 'lib/active_record/snapshot/files/version.rb', line 23 def download s3.download_to(path) end |
.filename ⇒ Object
31 32 33 |
# File 'lib/active_record/snapshot/files/version.rb', line 31 def filename "snapshot_version".freeze end |
.increment ⇒ Object
14 15 16 |
# File 'lib/active_record/snapshot/files/version.rb', line 14 def increment File.write(path, self.next) end |
.next ⇒ Object
10 11 12 |
# File 'lib/active_record/snapshot/files/version.rb', line 10 def next current + 1 end |
.path ⇒ Object
35 36 37 |
# File 'lib/active_record/snapshot/files/version.rb', line 35 def path config.store.local.join(filename).to_s.freeze end |
.upload ⇒ Object
27 28 29 |
# File 'lib/active_record/snapshot/files/version.rb', line 27 def upload s3.upload(path) end |
.write(version) ⇒ Object
18 19 20 21 |
# File 'lib/active_record/snapshot/files/version.rb', line 18 def write(version) return false unless version.to_i.to_s == version.to_s File.write(path, version) end |