Class: SimpleRSS::NormalizedEntry
- Inherits:
-
Object
- Object
- SimpleRSS::NormalizedEntry
- Defined in:
- lib/simple-rss/normalized_entry.rb
Overview
rbs_inline: enabled
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
: Array[Hash[Symbol, untyped]].
-
#authors ⇒ Object
readonly
: Array[Hash[Symbol, untyped]].
-
#banner_image ⇒ Object
readonly
: String?.
-
#categories ⇒ Object
readonly
: Array.
-
#category_details ⇒ Object
readonly
: Array[Hash[Symbol, untyped]].
-
#content_base_url ⇒ Object
readonly
: String?.
-
#content_html ⇒ Object
readonly
: String?.
-
#content_text ⇒ Object
readonly
: String?.
-
#content_url ⇒ Object
readonly
: String?.
-
#external_url ⇒ Object
readonly
: String?.
-
#field_sources ⇒ Object
readonly
: Hash[Symbol, untyped].
-
#identifier ⇒ Object
readonly
: String?.
-
#image ⇒ Object
readonly
: String?.
-
#issues ⇒ Object
readonly
: Array[Hash[Symbol, untyped]].
-
#language ⇒ Object
readonly
: String?.
-
#links ⇒ Object
readonly
: Array[Hash[Symbol, untyped]].
-
#published_at ⇒ Object
readonly
: Time?.
-
#raw ⇒ Object
readonly
: Hash[Symbol | String, untyped].
-
#raw_xml ⇒ Object
readonly
: String?.
-
#summary ⇒ Object
readonly
: String?.
-
#summary_type ⇒ Object
readonly
: Symbol?.
-
#title ⇒ Object
readonly
: String?.
-
#updated_at ⇒ Object
readonly
: Time?.
-
#url ⇒ Object
readonly
: String?.
Instance Method Summary collapse
- #effective_at ⇒ Object
-
#initialize(attributes) ⇒ NormalizedEntry
constructor
A new instance of NormalizedEntry.
- #to_h ⇒ Object
Constructor Details
#initialize(attributes) ⇒ NormalizedEntry
Returns a new instance of NormalizedEntry.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/simple-rss/normalized_entry.rb', line 16 def initialize(attributes) values = immutable_copy(attributes) empty_categories = [] #: Array[String] empty_records = [] #: Array[Hash[Symbol, untyped]] empty_data = {} #: Hash[Symbol, untyped] empty_categories.freeze empty_records.freeze empty_data.freeze @external_url = values[:external_url] @image = values[:image] = values[:banner_image] @language = values[:language] @identifier = values[:identifier] @url = values[:url] @title = values[:title] @published_at = values[:published_at] @updated_at = values[:updated_at] @content_html = values[:content_html] @content_text = values[:content_text] @content_url = values[:content_url] @content_base_url = values[:content_base_url] @summary = values[:summary] @summary_type = values[:summary_type] @categories = values.fetch(:categories, empty_categories) @category_details = values.fetch(:category_details, empty_records) = values.fetch(:attachments, empty_records) @links = values.fetch(:links, empty_records) = values.fetch(:authors, empty_records) @issues = values.fetch(:issues, empty_records) @raw = values.fetch(:raw, empty_data) @raw_xml = values[:raw_xml] @field_sources = values.fetch(:field_sources, empty_data) freeze end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
: Array[Hash[Symbol, untyped]]
10 11 12 |
# File 'lib/simple-rss/normalized_entry.rb', line 10 def end |
#authors ⇒ Object (readonly)
: Array[Hash[Symbol, untyped]]
10 11 12 |
# File 'lib/simple-rss/normalized_entry.rb', line 10 def end |
#banner_image ⇒ Object (readonly)
: String?
4 5 6 |
# File 'lib/simple-rss/normalized_entry.rb', line 4 def end |
#categories ⇒ Object (readonly)
: Array
9 10 11 |
# File 'lib/simple-rss/normalized_entry.rb', line 9 def categories @categories end |
#category_details ⇒ Object (readonly)
: Array[Hash[Symbol, untyped]]
10 11 12 |
# File 'lib/simple-rss/normalized_entry.rb', line 10 def category_details @category_details end |
#content_base_url ⇒ Object (readonly)
: String?
7 8 9 |
# File 'lib/simple-rss/normalized_entry.rb', line 7 def content_base_url @content_base_url end |
#content_html ⇒ Object (readonly)
: String?
7 8 9 |
# File 'lib/simple-rss/normalized_entry.rb', line 7 def content_html @content_html end |
#content_text ⇒ Object (readonly)
: String?
7 8 9 |
# File 'lib/simple-rss/normalized_entry.rb', line 7 def content_text @content_text end |
#content_url ⇒ Object (readonly)
: String?
7 8 9 |
# File 'lib/simple-rss/normalized_entry.rb', line 7 def content_url @content_url end |
#external_url ⇒ Object (readonly)
: String?
4 5 6 |
# File 'lib/simple-rss/normalized_entry.rb', line 4 def external_url @external_url end |
#field_sources ⇒ Object (readonly)
: Hash[Symbol, untyped]
12 13 14 |
# File 'lib/simple-rss/normalized_entry.rb', line 12 def field_sources @field_sources end |
#identifier ⇒ Object (readonly)
: String?
5 6 7 |
# File 'lib/simple-rss/normalized_entry.rb', line 5 def identifier @identifier end |
#image ⇒ Object (readonly)
: String?
4 5 6 |
# File 'lib/simple-rss/normalized_entry.rb', line 4 def image @image end |
#issues ⇒ Object (readonly)
: Array[Hash[Symbol, untyped]]
10 11 12 |
# File 'lib/simple-rss/normalized_entry.rb', line 10 def issues @issues end |
#language ⇒ Object (readonly)
: String?
4 5 6 |
# File 'lib/simple-rss/normalized_entry.rb', line 4 def language @language end |
#links ⇒ Object (readonly)
: Array[Hash[Symbol, untyped]]
10 11 12 |
# File 'lib/simple-rss/normalized_entry.rb', line 10 def links @links end |
#published_at ⇒ Object (readonly)
: Time?
6 7 8 |
# File 'lib/simple-rss/normalized_entry.rb', line 6 def published_at @published_at end |
#raw ⇒ Object (readonly)
: Hash[Symbol | String, untyped]
11 12 13 |
# File 'lib/simple-rss/normalized_entry.rb', line 11 def raw @raw end |
#raw_xml ⇒ Object (readonly)
: String?
13 14 15 |
# File 'lib/simple-rss/normalized_entry.rb', line 13 def raw_xml @raw_xml end |
#summary ⇒ Object (readonly)
: String?
7 8 9 |
# File 'lib/simple-rss/normalized_entry.rb', line 7 def summary @summary end |
#summary_type ⇒ Object (readonly)
: Symbol?
8 9 10 |
# File 'lib/simple-rss/normalized_entry.rb', line 8 def summary_type @summary_type end |
#title ⇒ Object (readonly)
: String?
5 6 7 |
# File 'lib/simple-rss/normalized_entry.rb', line 5 def title @title end |
#updated_at ⇒ Object (readonly)
: Time?
6 7 8 |
# File 'lib/simple-rss/normalized_entry.rb', line 6 def updated_at @updated_at end |
#url ⇒ Object (readonly)
: String?
5 6 7 |
# File 'lib/simple-rss/normalized_entry.rb', line 5 def url @url end |
Instance Method Details
#effective_at ⇒ Object
52 53 54 |
# File 'lib/simple-rss/normalized_entry.rb', line 52 def effective_at published_at || updated_at end |
#to_h ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/simple-rss/normalized_entry.rb', line 57 def to_h { external_url: external_url, image: image, banner_image: , language: language, identifier: identifier, url: url, title: title, published_at: published_at, updated_at: updated_at, content_html: content_html, content_text: content_text, content_url: content_url, content_base_url: content_base_url, summary: summary, summary_type: summary_type, categories: categories, category_details: category_details, attachments: , links: links, authors: , issues: issues, field_sources: field_sources, raw: raw, raw_xml: raw_xml } end |