Class: RSS2Mail::RSS::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/rss2mail/rss.rb

Instance Method Summary collapse

Constructor Details

#initialize(item) ⇒ Item

Returns a new instance of Item.



84
85
86
# File 'lib/rss2mail/rss.rb', line 84

def initialize(item)
  @item = item
end

Instance Method Details

#authorObject



106
107
108
# File 'lib/rss2mail/rss.rb', line 106

def author
  @author ||= value_for({ :author => %w[contributor dc_creator] }, %w[name content])
end

#body(tag = nil, encoding = nil) ⇒ Object



110
111
112
# File 'lib/rss2mail/rss.rb', line 110

def body(tag = nil, encoding = nil)
  @body ||= get_body(tag, encoding)
end

#dateObject



100
101
102
103
104
# File 'lib/rss2mail/rss.rb', line 100

def date
  @date ||= value_for({ :date => %w[pubDate updated dc_date] }, :content) { |field, value|
    field == 'updated' && value.respond_to?(:content) ? Time.at(value.content.to_i) : value
  }
end

#description(unescape_html = false) ⇒ Object



96
97
98
# File 'lib/rss2mail/rss.rb', line 96

def description(unescape_html = false)
  @description ||= get_description(unescape_html)
end


92
93
94
# File 'lib/rss2mail/rss.rb', line 92

def link
  @link ||= value_for(:link, :href)
end

#subjectObject



114
115
116
# File 'lib/rss2mail/rss.rb', line 114

def subject
  @subject ||= title ? clean_subject(title) : 'NO TITLE'
end

#titleObject



88
89
90
# File 'lib/rss2mail/rss.rb', line 88

def title
  @title ||= value_for(:title, :content)
end