class WipeOut::Plans::BuiltPlan
Provides final API after the plan had been build
Under the hood it contains plans but hides our under the hood implemention where we have helper methods for adding relations, attributes, etc.
Attributes
plan[R]
Public Class Methods
new(plan)
click to toggle source
# File lib/wipe_out/plans/built_plan.rb, line 10 def initialize(plan) @plan = plan end
Public Instance Methods
execute(record)
click to toggle source
Executes plan on a record
# File lib/wipe_out/plans/built_plan.rb, line 30 def execute(record) WipeOut::Execute.call(plan, record.class, record) end
validate(ar_class)
click to toggle source
Validates and returns any errors if validation fails.
It's not done automatically when plan is defined because plans can be combined and not be valid standalone.
@return [Array<String>] empty if everything is OK with the plan.
Returns non-empty list if issues are detected. You should call it in tests to ensure that plans are OK.
# File lib/wipe_out/plans/built_plan.rb, line 25 def validate(ar_class) WipeOut::Validate.call(plan, ar_class, @plan.config) end