Class: CloneKit::Rules::Except

Inherits:
CloneKit::Rule show all
Defined in:
lib/clone_kit/rules/except.rb

Overview

Removes attributes defined by an array of keys

Instance Attribute Summary

Attributes inherited from CloneKit::Rule

#id_generator

Instance Method Summary collapse

Constructor Details

#initialize(*excepted_attributes) ⇒ Except



9
10
11
# File 'lib/clone_kit/rules/except.rb', line 9

def initialize(*excepted_attributes)
  self.excepted_attributes = excepted_attributes
end

Instance Method Details

#fix(_old_id, attributes) ⇒ Object



13
14
15
16
17
# File 'lib/clone_kit/rules/except.rb', line 13

def fix(_old_id, attributes)
  excepted_attributes.each do |key|
    attributes.delete(key)
  end
end