internetee-registry/app/models/inactive_contacts.rb
2020-09-04 14:52:24 +03:00

20 lines
432 B
Ruby

class InactiveContacts
attr_reader :contacts
def initialize(contacts = Contact.archivable)
@contacts = contacts
end
def archive(verified: false)
contacts.each do |contact|
log("Archiving contact: id(#{contact.id}), code(#{contact.code})")
contact.archive(verified: verified)
yield contact if block_given?
end
end
def log(msg)
@log ||= Logger.new(STDOUT)
@log.info(msg)
end
end