Sha256: 94a770840f27b694f86d83bf5f658a442c62e72281d314d1acdb88e68a350d29

Contents?: true

Size: 485 Bytes

Versions: 4

Compression:

Stored size: 485 Bytes

Contents

module Twog
  class Post
    def initialize(post)
      @post = post
    end

    def link
      @post.link.respond_to?('href') ? @post.link.href : @post.link
    end

    def date
      @post.respond_to?('updated') ? @post.updated.content : @post.pubDate
    end
    
    def title
      @post.title.respond_to?('content') ? @post.title.content : @post.title
    end
    
    def <=>(other_post)
      Time.parse(self.date.to_s) <=> Time.parse(other_post.date.to_s)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twog-0.3.5 lib/twog/post.rb
twog-0.3.4 lib/twog/post.rb
twog-0.3.3 lib/twog/post.rb
twog-0.3.2 lib/twog/post.rb