Sha256: 907c20bf7b9b0fe1104d9c2d6c9ce019ee4027ead59177d428b4c2a4e33605af
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
module Feedzirra module FeedEntryUtilities def published @published || @updated end def parse_datetime(string) begin DateTime.parse(string).feed_utils_to_gm_time rescue puts "DATE CAN'T BE PARSED: #{string}" nil end end ## # Returns the id of the entry or its url if not id is present, as some formats don't support it def id @id || @url end ## # Summary is @summary of @content of nil. def summary @summary || @content end ## # Writter for published. By default, we keep the "oldest" publish time found. def published=(val) parsed = parse_datetime(val) @published = parsed if !@published || parsed < @published end ## # Writter for udapted. By default, we keep the most recenet update time found. def updated=(val) parsed = parse_datetime(val) @updated = parsed if !@updated || parsed > @updated end def sanitize! self.title.sanitize! if self.title self.author.sanitize! if self.author self.summary.sanitize! if self.summary self.content.sanitize! if self.content end alias_method :last_modified, :published end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
astro-feedzirra-0.0.12 | lib/feedzirra/feed_entry_utilities.rb |
julien51-feedzirra-0.0.13 | lib/feedzirra/feed_entry_utilities.rb |