Class: Html2rss::JsonFeedBuilder::Item
- Inherits:
-
Object
- Object
- Html2rss::JsonFeedBuilder::Item
- Defined in:
- lib/html2rss/json_feed_builder/item.rb
Overview
Maps an RssBuilder::Article to a JSONFeed 1.1 item hash.
Instance Method Summary collapse
-
#initialize(article) ⇒ Item
constructor
A new instance of Item.
-
#to_h ⇒ Hash?
The JSONFeed-compliant item hash.
Constructor Details
#initialize(article) ⇒ Item
Returns a new instance of Item.
10 11 12 |
# File 'lib/html2rss/json_feed_builder/item.rb', line 10 def initialize(article) @article = article end |
Instance Method Details
#to_h ⇒ Hash?
Returns the JSONFeed-compliant item hash.
16 17 18 19 20 21 |
# File 'lib/html2rss/json_feed_builder/item.rb', line 16 def to_h content = content_fields return if content.empty? item_payload.merge(content).compact end |