Class: Rssly::Serializers::Text
- Inherits:
-
Serializer
- Object
- Serializer
- Rssly::Serializers::Text
- Defined in:
- lib/rssly/serializers.rb
Overview
Transforms a collection into a text representation
Direct Known Subclasses
Constant Summary collapse
- ARTICLE_TEMPLATE =
<<-EOT ====== %{title} ====== Seen @ %{published} %{summary} Read on: %{url} -- EOT
Instance Method Summary collapse
Methods inherited from Serializer
Constructor Details
This class inherits a constructor from Rssly::Serializers::Serializer
Instance Method Details
#perform ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rssly/serializers.rb', line 28 def perform @collection.articles.reduce('') do |response, article| response + ARTICLE_TEMPLATE % { title: article.title, summary: article.summary, published: article.published, url: article.url } end end |