Class: Harold::Strategies::Cancel

Inherits:
Object
  • Object
show all
Defined in:
lib/strategies/cancel.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#cancelObject



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