Class: Textus::Jobs::Retention
- Inherits:
-
Object
- Object
- Textus::Jobs::Retention
- Defined in:
- lib/textus/jobs/retention.rb
Instance Method Summary collapse
- #call(rows) ⇒ Object
-
#initialize(container:, call:) ⇒ Retention
constructor
A new instance of Retention.
Constructor Details
#initialize(container:, call:) ⇒ Retention
Returns a new instance of Retention.
6 7 8 9 |
# File 'lib/textus/jobs/retention.rb', line 6 def initialize(container:, call:) @container = container @call = call end |
Instance Method Details
#call(rows) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/textus/jobs/retention.rb', line 11 def call(rows) out = { dropped: [], archived: [], failed: [] } rows.each do |row| key = row["key"] begin case row["action"] when "drop" delete(key) out[:dropped] << key when "archive" archive_leaf(row) delete(key) out[:archived] << key end rescue Textus::Error => e out[:failed] << { "key" => key, "error" => e. } end end out end |