Class: WipeOut::Plans::Union

Inherits:
Object
  • Object
show all
Defined in:
lib/wipe_out/plans/union.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plans, selector) ⇒ Union

Returns a new instance of Union.



6
7
8
9
# File 'lib/wipe_out/plans/union.rb', line 6

def initialize(plans, selector)
  @plans = plans
  @selector = selector
end

Instance Attribute Details

#plansObject (readonly)

Returns the value of attribute plans.



4
5
6
# File 'lib/wipe_out/plans/union.rb', line 4

def plans
  @plans
end

Instance Method Details

#establish_execution_plan(record) ⇒ Object



11
12
13
14
15
16
# File 'lib/wipe_out/plans/union.rb', line 11

def establish_execution_plan(record)
  plan = @selector.call(record).plan
  raise "Plan #{plan} is not listed in #{@plans}" unless @plans.include?(plan)

  plan
end