Class: Html2rss::Test::Result
- Inherits:
-
Data
- Object
- Data
- Html2rss::Test::Result
- Defined in:
- lib/html2rss/test.rb
Overview
Immutable outcome of a configuration test. Success carries rss XML from the
first live extraction; failures carry a typed FailureKind.
Instance Attribute Summary collapse
-
#channel_title ⇒ Object
readonly
Returns the value of attribute channel_title.
-
#channel_url ⇒ Object
readonly
Returns the value of attribute channel_url.
-
#duration_seconds ⇒ Object
readonly
Returns the value of attribute duration_seconds.
-
#enhance_compare ⇒ Object
readonly
Returns the value of attribute enhance_compare.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#failure_kind ⇒ Object
readonly
Returns the value of attribute failure_kind.
-
#item_count ⇒ Object
readonly
Returns the value of attribute item_count.
-
#quality_report ⇒ Object
readonly
Returns the value of attribute quality_report.
-
#rss ⇒ Object
readonly
Returns the value of attribute rss.
-
#sample_items ⇒ Object
readonly
Returns the value of attribute sample_items.
-
#strategy_used ⇒ Object
readonly
Returns the value of attribute strategy_used.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#validation_errors ⇒ Object
readonly
Returns the value of attribute validation_errors.
Instance Method Summary collapse
-
#empty_feed? ⇒ Boolean
Whether the test extracted zero items.
-
#initialize(success:, item_count:, sample_items:, channel_title:, channel_url:, strategy_used:, duration_seconds:, validation_errors:, error_message:, failure_kind:, rss:, quality_report: nil, enhance_compare: nil) ⇒ Result
constructor
A new instance of Result.
-
#to_h ⇒ Hash{Symbol => Object}
Hash representation.
-
#valid_schema? ⇒ Boolean
Whether the schema validation succeeded.
Constructor Details
#initialize(success:, item_count:, sample_items:, channel_title:, channel_url:, strategy_used:, duration_seconds:, validation_errors:, error_message:, failure_kind:, rss:, quality_report: nil, enhance_compare: nil) ⇒ Result
Returns a new instance of Result.
122 123 124 125 126 |
# File 'lib/html2rss/test.rb', line 122 def initialize(success:, item_count:, sample_items:, channel_title:, channel_url:, # rubocop:disable Metrics/ParameterLists strategy_used:, duration_seconds:, validation_errors:, error_message:, failure_kind:, rss:, quality_report: nil, enhance_compare: nil) super end |
Instance Attribute Details
#channel_title ⇒ Object (readonly)
Returns the value of attribute channel_title
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def channel_title @channel_title end |
#channel_url ⇒ Object (readonly)
Returns the value of attribute channel_url
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def channel_url @channel_url end |
#duration_seconds ⇒ Object (readonly)
Returns the value of attribute duration_seconds
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def duration_seconds @duration_seconds end |
#enhance_compare ⇒ Object (readonly)
Returns the value of attribute enhance_compare
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def enhance_compare @enhance_compare end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def end |
#failure_kind ⇒ Object (readonly)
Returns the value of attribute failure_kind
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def failure_kind @failure_kind end |
#item_count ⇒ Object (readonly)
Returns the value of attribute item_count
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def item_count @item_count end |
#quality_report ⇒ Object (readonly)
Returns the value of attribute quality_report
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def quality_report @quality_report end |
#rss ⇒ Object (readonly)
Returns the value of attribute rss
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def rss @rss end |
#sample_items ⇒ Object (readonly)
Returns the value of attribute sample_items
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def sample_items @sample_items end |
#strategy_used ⇒ Object (readonly)
Returns the value of attribute strategy_used
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def strategy_used @strategy_used end |
#success ⇒ Object (readonly)
Returns the value of attribute success
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def success @success end |
#validation_errors ⇒ Object (readonly)
Returns the value of attribute validation_errors
93 94 95 |
# File 'lib/html2rss/test.rb', line 93 def validation_errors @validation_errors end |
Instance Method Details
#empty_feed? ⇒ Boolean
Returns whether the test extracted zero items.
136 137 138 |
# File 'lib/html2rss/test.rb', line 136 def empty_feed? item_count.zero? end |
#to_h ⇒ Hash{Symbol => Object}
Returns hash representation.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/html2rss/test.rb', line 142 def to_h # rubocop:disable Metrics/MethodLength { success:, item_count:, sample_items:, channel_title:, channel_url:, strategy_used:, duration_seconds:, validation_errors:, error_message:, failure_kind: failure_kind&.to_sym, rss:, quality_report: quality_report&.to_h, enhance_compare: }.compact end |
#valid_schema? ⇒ Boolean
Returns whether the schema validation succeeded.
130 131 132 |
# File 'lib/html2rss/test.rb', line 130 def valid_schema? validation_errors.nil? || validation_errors.empty? end |