Class: Harold::Strategies::Cancel
- Inherits:
-
Object
- Object
- Harold::Strategies::Cancel
- Defined in:
- lib/strategies/cancel.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(operations) ⇒ Cancel
constructor
A new instance of Cancel.
Constructor Details
#initialize(operations) ⇒ Cancel
Returns a new instance of Cancel.
10 11 12 13 |
# File 'lib/strategies/cancel.rb', line 10 def initialize(operations) @operations = operations @useful_items = useful_items(operations) end |
Class Method Details
.call(operations) ⇒ Object
4 5 6 |
# File 'lib/strategies/cancel.rb', line 4 def self.call(operations) new(operations).cancel end |
Instance Method Details
#cancel ⇒ Object
15 16 17 18 19 |
# File 'lib/strategies/cancel.rb', line 15 def cancel @operations.select do |operation| @useful_items.include?(operation.id) end end |