Class: Spix::Parser::FeedEntry
- Includes:
- Memoizable, DateTimeUtilities
- Defined in:
- lib/spix_parser/wrappers/entry.rb
Instance Method Summary collapse
- #author ⇒ Object
- #categories ⇒ Object
- #content ⇒ Object
- #enclosures ⇒ Object
-
#initialize(entry, feed) ⇒ FeedEntry
constructor
A new instance of FeedEntry.
- #published_at ⇒ Object
- #striped_content ⇒ Object
- #summary ⇒ Object
- #title ⇒ Object
- #uid ⇒ Object
- #updated_at ⇒ Object
- #url ⇒ Object
Methods included from DateTimeUtilities
Constructor Details
#initialize(entry, feed) ⇒ FeedEntry
Returns a new instance of FeedEntry.
8 9 10 11 |
# File 'lib/spix_parser/wrappers/entry.rb', line 8 def initialize(entry, feed) @feed = feed @entry = entry end |
Instance Method Details
#author ⇒ Object
35 36 37 38 |
# File 'lib/spix_parser/wrappers/entry.rb', line 35 def text = @entry. || "" Sanitizer.sanitize(text.busk_normalize) end |
#categories ⇒ Object
72 73 74 75 76 |
# File 'lib/spix_parser/wrappers/entry.rb', line 72 def categories @entry.entry_categories.map do |category| Sanitizer.sanitize(category.busk_normalize) end end |
#content ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/spix_parser/wrappers/entry.rb', line 56 def content text = encoded_raw_content text = Sanitizer.strip_comments(text) text = Sanitizer.(text) text = Sanitizer.entities_to_chars(text) text = Spix::Utils.publisher_special_case :text => text, :url => @feed.url Spix::Utils.format_links({:text => text, :site_url => @feed.site_url}) end |
#enclosures ⇒ Object
78 79 80 |
# File 'lib/spix_parser/wrappers/entry.rb', line 78 def enclosures @entry.entry_enclosures end |
#published_at ⇒ Object
40 41 42 |
# File 'lib/spix_parser/wrappers/entry.rb', line 40 def published_at build_datetime_object(@entry.published) if @entry.published end |
#striped_content ⇒ Object
66 67 68 69 |
# File 'lib/spix_parser/wrappers/entry.rb', line 66 def striped_content text = encoded_raw_content Sanitizer.(text) end |
#summary ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/spix_parser/wrappers/entry.rb', line 20 def summary text = @entry.entry_summary || "" text = text.busk_normalize text = Sanitizer.strip_comments(text) text = Sanitizer.(text) Sanitizer.entities_to_chars(text) end |
#title ⇒ Object
13 14 15 16 17 |
# File 'lib/spix_parser/wrappers/entry.rb', line 13 def title text = @entry.entry_title || "(title unknow)" text = text.busk_normalize Sanitizer.sanitize(text) end |
#uid ⇒ Object
48 49 50 51 52 53 |
# File 'lib/spix_parser/wrappers/entry.rb', line 48 def uid uid = self.url || "" uid += encoded_raw_content_for :title uid += encoded_raw_content[0..25] uid.to_sha1 end |
#updated_at ⇒ Object
44 45 46 |
# File 'lib/spix_parser/wrappers/entry.rb', line 44 def updated_at build_datetime_object(@entry.updated) if @entry.updated end |
#url ⇒ Object
29 30 31 32 |
# File 'lib/spix_parser/wrappers/entry.rb', line 29 def url entry_url = @entry.entry_url || @feed.site_url RedirectFollower.resolve(entry_url).busk_normalize if entry_url.present? end |