Class: Anony::Strategies::Destroy

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

Overview

The interface for configuring a destroy strategy. This strategy is not compatible with Anony::Strategies::Overwrite.

Examples:

anonymise do
  destroy
end

Instance Method Summary collapse

Instance Method Details

#apply(instance) ⇒ Object

Apply the Destroy strategy to the model instance. In this case, it calls ‘#destroy!`.

Parameters:

  • instance (ActiveRecord::Base)

    An instance of the model



33
34
35
36
# File 'lib/anony/strategies/destroy.rb', line 33

def apply(instance)
  instance.destroy!
  Result.destroyed
end

#valid?true

Whether the strategy is valid. This strategy takes no configuration, so #valid? always returns true

Returns:

  • (true)


17
18
19
# File 'lib/anony/strategies/destroy.rb', line 17

def valid?
  true
end

#validate!true

Whether the strategy is valid, raising an exception if not. This strategy takes no configuration, so #validate! always returns true

Returns:

  • (true)


25
26
27
# File 'lib/anony/strategies/destroy.rb', line 25

def validate!
  true
end