Class: EbsPruneSnapshot::SnapshotAnalyzer
- Inherits:
-
Object
- Object
- EbsPruneSnapshot::SnapshotAnalyzer
- Defined in:
- lib/ebs_prune_snapshot.rb
Instance Attribute Summary collapse
-
#rotation ⇒ Object
readonly
Returns the value of attribute rotation.
-
#snapshots ⇒ Object
readonly
Returns the value of attribute snapshots.
-
#to_skip ⇒ Object
readonly
Returns the value of attribute to_skip.
Instance Method Summary collapse
-
#initialize(snapshots, rotation) ⇒ SnapshotAnalyzer
constructor
A new instance of SnapshotAnalyzer.
- #now ⇒ Object
- #to_delete ⇒ Object
- #to_save ⇒ Object
Constructor Details
#initialize(snapshots, rotation) ⇒ SnapshotAnalyzer
Returns a new instance of SnapshotAnalyzer.
86 87 88 89 90 91 92 93 |
# File 'lib/ebs_prune_snapshot.rb', line 86 def initialize(snapshots, rotation) @snapshots = snapshots.sort @rotation = rotation @to_skip = [] @to_delete = [] @to_save = {} analyze_snapshots end |
Instance Attribute Details
#rotation ⇒ Object (readonly)
Returns the value of attribute rotation.
84 85 86 |
# File 'lib/ebs_prune_snapshot.rb', line 84 def rotation @rotation end |
#snapshots ⇒ Object (readonly)
Returns the value of attribute snapshots.
84 85 86 |
# File 'lib/ebs_prune_snapshot.rb', line 84 def snapshots @snapshots end |
#to_skip ⇒ Object (readonly)
Returns the value of attribute to_skip.
84 85 86 |
# File 'lib/ebs_prune_snapshot.rb', line 84 def to_skip @to_skip end |
Instance Method Details
#now ⇒ Object
103 104 105 |
# File 'lib/ebs_prune_snapshot.rb', line 103 def now @now ||= Time.now.utc end |
#to_delete ⇒ Object
99 100 101 |
# File 'lib/ebs_prune_snapshot.rb', line 99 def to_delete snapshots - to_save - to_skip end |
#to_save ⇒ Object
95 96 97 |
# File 'lib/ebs_prune_snapshot.rb', line 95 def to_save @to_save.empty? ? [snapshots[-1]] : @to_save.values end |