Class: Twog::Post

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

Instance Method Summary collapse

Constructor Details

#initialize(post) ⇒ Post



5
6
7
# File 'lib/twog/post.rb', line 5

def initialize(post)
  @post = post
end

Instance Method Details

#<=>(other) ⇒ Object



21
22
23
# File 'lib/twog/post.rb', line 21

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

#dateObject



13
14
15
# File 'lib/twog/post.rb', line 13

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


9
10
11
# File 'lib/twog/post.rb', line 9

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

#titleObject



17
18
19
# File 'lib/twog/post.rb', line 17

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