Sha256: bd9077e38553ac71484be968a32fd501e58008cb492f9a25c93e603faec4c0c0

Contents?: true

Size: 493 Bytes

Versions: 1

Compression:

Stored size: 493 Bytes

Contents

# frozen_string_literal: true

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)
      Time.parse(date.to_s) <=> Time.parse(other.date.to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twog-0.3.6 lib/twog/post.rb