Class: Twog::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/twog/post.rb

Instance Method Summary collapse

Constructor Details

#initialize(post) ⇒ Post

Returns a new instance of Post.



3
4
5
# File 'lib/twog/post.rb', line 3

def initialize(post)
  @post = post
end

Instance Method Details

#<=>(other_post) ⇒ Object



19
20
21
# File 'lib/twog/post.rb', line 19

def <=>(other_post)
  Time.parse(self.date.to_s) <=> Time.parse(other_post.date.to_s)
end

#dateObject



11
12
13
# File 'lib/twog/post.rb', line 11

def date
  @post.respond_to?('updated') ? @post.updated.content : @post.pubDate
end


7
8
9
# File 'lib/twog/post.rb', line 7

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

#titleObject



15
16
17
# File 'lib/twog/post.rb', line 15

def title
  @post.title.respond_to?('content') ? @post.title.content : @post.title
end