class PrismQA::ReportSet

A prism ReportSet produces a set of reports, one for each attribute (plus one for the nil attribute)

Attributes

app_spectra[RW]
design_spectrum[RW]
img_width_px[RW]
path_for_attribute_fn[RW]
title_for_attribute_fn[RW]
web_document_root[RW]

Public Instance Methods

_configured_report(attribute, output_path) click to toggle source
# File gem/lib/prism_qa/reportset.rb, line 23
def _configured_report(attribute, output_path)
  r = Report.new
  r.title             = @title_for_attribute_fn.call(attribute)
  r.attribute         = attribute
  r.design_spectrum   = @design_spectrum
  r.app_spectra       = @app_spectra
  r.web_document_root = @web_document_root
  r.destination_path  = output_path
  r.img_width_px      = @img_width_px
  r
end
allow_path(path) click to toggle source

Check whether the path is correct, particularly if we are making a web-based report

# File gem/lib/prism_qa/reportset.rb, line 15
def allow_path(path)
  unless @web_document_root.nil?
    unless ancestor?(@web_document_root, path)
      raise OperationalError, "Report #{path} is not an ancestor of the web root #{@web_document_root}"
    end
  end
end
write() click to toggle source
# File gem/lib/prism_qa/reportset.rb, line 35
def write
  @design_spectrum.image_set.contained_attributes.map do |attr|

    # first check whether the destination is ok
    path = @path_for_attribute_fn.call(attr)
    allow_path path

    rpt = _configured_report(attr, path)
    File.open(path, 'w') { |f| f.write(rpt.to_s) }
  end
end