Class: Twog::Post
- Inherits:
-
Object
- Object
- Twog::Post
- Defined in:
- lib/twog/post.rb
Instance Method Summary collapse
- #<=>(other_post) ⇒ Object
- #date ⇒ Object
-
#initialize(post) ⇒ Post
constructor
A new instance of Post.
- #link ⇒ Object
- #title ⇒ Object
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 |
#date ⇒ Object
11 12 13 |
# File 'lib/twog/post.rb', line 11 def date @post.respond_to?('updated') ? @post.updated.content : @post.pubDate end |
#link ⇒ Object
7 8 9 |
# File 'lib/twog/post.rb', line 7 def link @post.link.respond_to?('href') ? @post.link.href : @post.link end |
#title ⇒ Object
15 16 17 |
# File 'lib/twog/post.rb', line 15 def title @post.title.respond_to?('content') ? @post.title.content : @post.title end |