Class: Textus::Background::Retention::Apply
- Inherits:
-
Object
- Object
- Textus::Background::Retention::Apply
- Defined in:
- lib/textus/background/retention/apply.rb
Instance Method Summary collapse
- #call(rows) ⇒ Object
-
#initialize(container:, call:) ⇒ Apply
constructor
A new instance of Apply.
Constructor Details
#initialize(container:, call:) ⇒ Apply
Returns a new instance of Apply.
7 8 9 10 |
# File 'lib/textus/background/retention/apply.rb', line 7 def initialize(container:, call:) @container = container @call = call end |
Instance Method Details
#call(rows) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/textus/background/retention/apply.rb', line 12 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 |