internetee-registry/app/models/inactive_contacts.rb
2021-09-09 09:19:09 +03:00

20 lines
433 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