class SeoReport::Representation::Base

Attributes

report[R]

Public Class Methods

new(report) click to toggle source
# File lib/seo_report/representation/base.rb, line 23
def initialize(report)
  @report = report
end
represent_with_report_for(url) click to toggle source
# File lib/seo_report/representation/base.rb, line 10
def self.represent_with_report_for(url)
  report = SeoReport::Report.new(url)
  report.produce
  new(report).represent
rescue StandardError => _error
  debug = ENV["SEO_REPORT_DEBUG"]
  if debug.to_i > 0
    raise
  else
    abort("-- Sorry, something went wrong when creating the report.")
  end
end

Public Instance Methods

any_data_in_hash?(hash) click to toggle source
# File lib/seo_report/representation/base.rb, line 31
def any_data_in_hash?(hash)
  (hash || {}).select { |_, val| !val.nil? }.any?
end
represent() click to toggle source
# File lib/seo_report/representation/base.rb, line 27
def represent
  raise NotImplementedError.new("#represent needs to be implemented by a subclass.")
end