class Diecut::ReportBuilder
Attributes
mill[R]
Public Class Methods
all_kinds()
click to toggle source
# File lib/diecut/report-builder.rb, line 5 def self.all_kinds @all_kinds ||= [] end
new(mill)
click to toggle source
# File lib/diecut/report-builder.rb, line 13 def initialize(mill) @mill = mill end
register()
click to toggle source
# File lib/diecut/report-builder.rb, line 9 def self.register ReportBuilder.all_kinds << self end
Public Instance Methods
build_report()
click to toggle source
# File lib/diecut/report-builder.rb, line 56 def build_report Report.new(report_name, report_fields) end
each_default() { |default, plugin| ... }
click to toggle source
# File lib/diecut/report-builder.rb, line 30 def each_default each_plugin do |plugin| plugin.context_defaults.each do |default| yield default, plugin end end end
each_option() { |option, plugin| ... }
click to toggle source
# File lib/diecut/report-builder.rb, line 38 def each_option each_plugin do |plugin| plugin.options.each do |option| yield option, plugin end end end
each_plugin() { |plugin| ... }
click to toggle source
# File lib/diecut/report-builder.rb, line 24 def each_plugin mill.mediator.activated_plugins.each do |plugin| yield plugin end end
each_template() { |name, template| ... }
click to toggle source
# File lib/diecut/report-builder.rb, line 46 def each_template mill.templates.templates.each do |name, template| yield name, template end end
fail_advice()
click to toggle source
# File lib/diecut/report-builder.rb, line 91 def fail_advice nil end
fail_summary()
click to toggle source
# File lib/diecut/report-builder.rb, line 79 def fail_summary nil end
go()
click to toggle source
# File lib/diecut/report-builder.rb, line 65 def go collect review report end
other_advice()
click to toggle source
# File lib/diecut/report-builder.rb, line 95 def other_advice nil end
other_summary()
click to toggle source
# File lib/diecut/report-builder.rb, line 83 def other_summary nil end
pass_advice()
click to toggle source
# File lib/diecut/report-builder.rb, line 87 def pass_advice nil end
pass_summary()
click to toggle source
# File lib/diecut/report-builder.rb, line 75 def pass_summary nil end
report()
click to toggle source
# File lib/diecut/report-builder.rb, line 52 def report @report ||= build_report end
report_status()
click to toggle source
# File lib/diecut/report-builder.rb, line 71 def report_status report.empty? ? 'OK' : 'FAIL' end
review()
click to toggle source
# File lib/diecut/report-builder.rb, line 99 def review report.status = report_status.to_s.upcase case report.status when "OK", "PASS" report.summary = pass_summary report.advice = unindent(pass_advice) when 'FAIL' report.summary = fail_summary report.advice = unindent(fail_advice) else report.summary = other_summary report.advice = unindent(other_advice) end end
strict_sequence?(first, second)
click to toggle source
# File lib/diecut/report-builder.rb, line 60 def strict_sequence?(first, second) return false if first == second Diecut.plugin_loader.strict_sequence?(first, second) end
unindent(text)
click to toggle source
# File lib/diecut/report-builder.rb, line 18 def unindent(text) return if text.nil? indent = text.scan(/(^[ \t]*)\S/).map{|cap| cap.first}.max_by(&:length) text.gsub(%r{^#{indent}},'') end