Module: WipeOut

Extended by:
Forwardable
Defined in:
lib/wipe_out.rb,
lib/wipe_out/config.rb,
lib/wipe_out/plugin.rb,
lib/wipe_out/execute.rb,
lib/wipe_out/version.rb,
lib/wipe_out/callback.rb,
lib/wipe_out/validate.rb,
lib/wipe_out/plans/dsl.rb,
lib/wipe_out/plans/plan.rb,
lib/wipe_out/plans/union.rb,
lib/wipe_out/plugins/logger.rb,
lib/wipe_out/validators/base.rb,
lib/wipe_out/plans/built_plan.rb,
lib/wipe_out/execution/context.rb,
lib/wipe_out/callbacks_observer.rb,
lib/wipe_out/validators/attributes.rb,
lib/wipe_out/execution/execute_plan.rb,
lib/wipe_out/validators/relations_plans.rb,
lib/wipe_out/attribute_strategies/nullify.rb,
lib/wipe_out/validators/defined_relations.rb,
lib/wipe_out/attribute_strategies/randomize.rb,
lib/wipe_out/attribute_strategies/const_value.rb

Overview

When working with gem please see getting_started

If you'd like to contribute, check out development

Defined Under Namespace

Modules: AttributeStrategies, Execution, Plans, Plugin, Plugins, Validators Classes: Callback, CallbacksObserver, Config, Execute, Validate, ValidationResult

Constant Summary collapse

IGNORE_ALL =
:ignore_all
VERSION =
"1.1.0".freeze

Class Method Summary collapse

Class Method Details

.build_plan(config: nil, &block) ⇒ Plans::BuiltPlan

Builds a plan for wipe out. When ActiveRecord class is passed,

For DSL documentation WipeOut::Plans::Dsl

Examples:

UserPlan = WipeOut.build_plan do
  wipe_out :name
end

Returns:



29
30
31
32
33
# File 'lib/wipe_out.rb', line 29

def build_plan(config: nil, &block)
  config ||= WipeOut.config.dup
  plan = Plans::Plan.new(config)
  Plans::Dsl.build(plan, &block)
end

.configConfig

Returns current configuration

Returns:



58
59
60
# File 'lib/wipe_out.rb', line 58

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Config

Configures the gem, you should call it in the initializer

For additional details, Config. You will be also able to modify config for specific plan. Here you only set defaults.

Examples:

WipeOut.configure do |config|
  config.ignored_attributes = %i[id inserted_at]
end

Yields:

Returns:



47
48
49
50
51
52
53
# File 'lib/wipe_out.rb', line 47

def configure
  raise "Pass block to configure the gem" unless block_given?

  yield config

  config
end