Class: Undo::Wrapper::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/undo/wrapper/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Configuration

Returns a new instance of Configuration.



6
7
8
# File 'lib/undo/wrapper/configuration.rb', line 6

def initialize(attributes = {})
  @store_on = attributes.fetch :store_on, [:delete, :destroy]
end

Instance Attribute Details

#store_onObject

Returns the value of attribute store_on.



4
5
6
# File 'lib/undo/wrapper/configuration.rb', line 4

def store_on
  @store_on
end

Instance Method Details

#with(attribute_updates = {}) ⇒ Object



10
11
12
# File 'lib/undo/wrapper/configuration.rb', line 10

def with(attribute_updates = {})
  self.class.new store_on: (attribute_updates.delete(:store_on) || store_on)
end