Class: Html2rss::Test::QualityReport

Inherits:
Data
  • Object
show all
Defined in:
lib/html2rss/test.rb

Overview

Ship-quality audit summary for a configuration test (warn-only).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defer_reasonObject (readonly)

Returns the value of attribute defer_reason

Returns:

  • the current value of defer_reason



64
65
66
# File 'lib/html2rss/test.rb', line 64

def defer_reason
  @defer_reason
end

#metricsObject (readonly)

Returns the value of attribute metrics

Returns:

  • the current value of metrics



64
65
66
# File 'lib/html2rss/test.rb', line 64

def metrics
  @metrics
end

#native_feedObject (readonly)

Returns the value of attribute native_feed

Returns:

  • the current value of native_feed



64
65
66
# File 'lib/html2rss/test.rb', line 64

def native_feed
  @native_feed
end

#warningsObject (readonly)

Returns the value of attribute warnings

Returns:

  • the current value of warnings



64
65
66
# File 'lib/html2rss/test.rb', line 64

def warnings
  @warnings
end

Class Method Details

.from_audit(audit, native_feed: nil) ⇒ QualityReport

Parameters:

  • (defaults to: nil)

Returns:



79
80
81
82
83
84
85
86
87
# File 'lib/html2rss/test.rb', line 79

def self.from_audit(audit, native_feed: nil)
  report_warnings = audit.warnings.dup
  defer_reason = nil
  if native_feed
    report_warnings << :native_feed_present unless report_warnings.include?(:native_feed_present)
    defer_reason = :native_feed
  end
  new(warnings: report_warnings.freeze, metrics: audit.metrics, native_feed:, defer_reason:)
end

Instance Method Details

#to_hHash{Symbol => Object}

Returns:



67
68
69
70
71
72
73
# File 'lib/html2rss/test.rb', line 67

def to_h
  {
    warnings: warnings.map(&:to_s),
    metrics:,
    **(native_feed ? { native_feed:, defer_reason: defer_reason.to_s } : {})
  }.compact
end