Sha256: efb6d1d04e2a040f2b5eee94639c064a791f29a7296b2f87515048a686895bbf

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feed2mail-0.0.1 lib/feed2mail/history.rb