Class: AttributesSanitizer::Overrider

Inherits:
Object
  • Object
show all
Defined in:
lib/attributes_sanitizer/overrider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Overrider

Returns a new instance of Overrider.



6
7
8
# File 'lib/attributes_sanitizer/overrider.rb', line 6

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



4
5
6
# File 'lib/attributes_sanitizer/overrider.rb', line 4

def klass
  @klass
end

Instance Method Details

#override_getters_and_settersObject



10
11
12
13
14
15
16
17
# File 'lib/attributes_sanitizer/overrider.rb', line 10

def override_getters_and_setters
  return if klass.attributes_sanitize_map.blank?

  attributes_to_override.each do |attribute|
    override_getter(attribute)
    override_setter(attribute)
  end
end