Class: Redundancy::UpdateBase

Inherits:
Object
  • Object
show all
Defined in:
lib/redundancy/update_base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ UpdateBase

Returns a new instance of UpdateBase.



8
9
10
11
12
13
14
15
16
# File 'lib/redundancy/update_base.rb', line 8

def initialize options
  @options = options
  @klass = options[:klass]
  @source, @dest = options[:source], options[:dest]
  @change_if = options[:change_if]
  @update = options[:update] || false

  cleanup_context
end

Instance Attribute Details

#change_ifObject (readonly)

Returns the value of attribute change_if.



5
6
7
# File 'lib/redundancy/update_base.rb', line 5

def change_if
  @change_if
end

#destObject (readonly)

Returns the value of attribute dest.



5
6
7
# File 'lib/redundancy/update_base.rb', line 5

def dest
  @dest
end

#klassObject (readonly)

Returns the value of attribute klass.



5
6
7
# File 'lib/redundancy/update_base.rb', line 5

def klass
  @klass
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/redundancy/update_base.rb', line 4

def options
  @options
end

#sourceObject (readonly)

Returns the value of attribute source.



5
6
7
# File 'lib/redundancy/update_base.rb', line 5

def source
  @source
end

Instance Method Details

#after_save(record) ⇒ Object



26
27
# File 'lib/redundancy/update_base.rb', line 26

def after_save record
end

#before_save(record) ⇒ Object

ActiveRecord Hooks



23
24
# File 'lib/redundancy/update_base.rb', line 23

def before_save record
end

#force_update!(record) ⇒ Object



18
19
20
# File 'lib/redundancy/update_base.rb', line 18

def force_update! record
  set_context :force, true
end