diff --git a/lib/transmission-rss/aggregator.rb b/lib/transmission-rss/aggregator.rb index 2101b6b..a8993ef 100644 --- a/lib/transmission-rss/aggregator.rb +++ b/lib/transmission-rss/aggregator.rb @@ -113,7 +113,7 @@ def process_link(feed, item) link = link.href if link.class != String # Determine whether to use guid or link as seen hash - seen_value = !!feed.seen_by_guid ? (item.guid.content rescue item.guid || link).to_s : link + seen_value = feed.seen_by_guid ? (item.guid.content rescue item.guid || link).to_s : link # The link is not in +@seen+ Array. unless @seen.include?(seen_value) diff --git a/lib/transmission-rss/feed.rb b/lib/transmission-rss/feed.rb index a382b32..0bf0b0a 100644 --- a/lib/transmission-rss/feed.rb +++ b/lib/transmission-rss/feed.rb @@ -12,8 +12,6 @@ def initialize(config = {}) @url = URI.escape(URI.unescape(config['url'] || config.keys.first)) @download_path = config['download_path'] - @validate_cert = config['validate_cert'].nil? || !!config['validate_cert'] - @seen_by_guid = !!config['seen_by_guid'] matchers = Array(config['regexp']).map do |e| e.is_a?(String) ? e : e['matcher'] @@ -26,6 +24,9 @@ def initialize(config = {}) @config = {} @url = config.to_s end + + @validate_cert = @config['validate_cert'].nil? || !!@config['validate_cert'] + @seen_by_guid = !!@config['seen_by_guid'] end def download_path(title = nil) diff --git a/spec/feed_spec.rb b/spec/feed_spec.rb index 58de3ab..d3d93a3 100644 --- a/spec/feed_spec.rb +++ b/spec/feed_spec.rb @@ -15,8 +15,8 @@ expect(feed.config).not_to be_nil expect(feed.download_path).to be_nil expect(feed.regexp).to be_nil - expect(feed.validate_cert).to be_nil - expect(feed.seen_by_guid).to be_nil + expect(feed.validate_cert).to eq(true) + expect(feed.seen_by_guid).to eq(false) end it 'should be able to parse encoded url' do