Method: App::Tools.validate_report_width

Defined in:
lib/core/tools.rb

.validate_report_width(array) ⇒ Object

Used to make sure all reports are the same width (for consistency).

Returns:

  • void



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/core/tools.rb', line 67

def self.validate_report_width(array)
    unless array.is_a?(Array)
        raise RuntimeError, "Expected Array, got: #{array.class}"
    end
    report_width = 0
    array.each do |pixels|
        report_width = report_width + pixels.to_i
    end
    unless report_width == REPORT_WIDTH
        raise RuntimeError, "Report needs to be #{REPORT_WIDTH} pixels wide, calculated #{report_width} pixels."
    end
end