require 'yaml' module Feed2Mail class History def initialize(config) @hist_file = config.hist_file || HIST_FILE begin @hist = YAML.load_file(File.expand_path(@hist_file)) rescue Errno::ENOENT @hist = [] end end def has?(uri) @hist.include?(uri) ? true : false end def <<(other) @hist << other end def save! File.open File.expand_path(@hist_file), 'w' do |h| h.write @hist.to_yaml end end end end