16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/gitlab_notifier.rb', line 16
def self.
configs = YAML.load_file(CONFIG_FILE)
configs['atom'].each do |atom|
atom_type, atom_address = atom
atom_last_read = configs['last_read']["#{atom_type}"]
= ::Parser.parse(atom_address, false)
next if !atom_last_read.nil? && .updated.content <= atom_last_read
.items.select do |item|
notify "#{item.title.content}", title: "#{atom_type.capitalize}" if atom_last_read.nil? || item.updated.content > atom_last_read
end
configs['last_read']["#{atom_type}"] = .updated.content
File.open(CONFIG_FILE, 'w') { |f| YAML.dump(configs, f) }
end
end
|