Sha256: c6786ba57a6f462eebe75bbbd9408548910cc5080fc09ddb1c371824091d4477

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

module Feedzirra
  module FeedEntryUtilities
    attr_reader :published
    
    def parse_datetime(string)
      DateTime.parse(string).feed_utils_to_gm_time
    end
    
    def published=(val)
      @published = parse_datetime(val)
    end
    
    def sanitized
      dispatcher = Class.new do
        def initialize(entry)
          @entry = entry
        end
        
        def method_missing(method, *args)
          Dryopteris.sanitize(@entry.send(method))
        end
      end
      dispatcher.new(self)
    end
    
    def sanitize!
      self.title   = sanitized.title
      self.author  = sanitized.author
      self.content = sanitized.content
    end
    
    alias_method :last_modified, :published
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
pauldix-feedzirra-0.0.2 lib/feedzirra/feed_entry_utilities.rb
somezack-feedzirra-0.0.2 lib/feedzirra/feed_entry_utilities.rb