Method: StripAttributes.strip_record

Defined in:
lib/strip_attributes.rb

.strip_record(record, options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/strip_attributes.rb', line 41

def self.strip_record(record, options = {})
  attributes = narrow(record.attributes, options)

  attributes.each do |attr, value|
    original_value = value
    value = strip_string(value, options)
    record[attr] = value if original_value != value
  end

  record
end