class Diecut::ReportBuilders::OptionCollisions

Public Instance Methods

collect() click to toggle source
# File lib/diecut/report-builders/option-collision.rb, line 16
def collect
  option_targets = Hash.new{|h,k| h[k]=[]}
  each_option do |option, plugin|
    next unless option.has_context_path?
    option_targets[option.context_path] << [plugin, option]
  end
  option_targets.each_value do |set|
    if set.length > 1
      set.each do |plugin, option|
        report.add(option.context_path.join("."), option.name, plugin.name)
      end
    end
  end
end
fail_advice() click to toggle source
# File lib/diecut/report-builders/option-collision.rb, line 35
      def fail_advice
        (<<-EOA)
          This is problem because two options in the user interface both change
          rendered values. If a user supplies both with different values, the
          output isn't predictable (either one might take effect).

          Most likely, this is a simple error: remove options from each group
          that targets the same rendered value until only one remains. It may
          also be that one option has a typo - that there's a rendering target
          that's omitted.
        EOA
      end
fail_summary() click to toggle source
# File lib/diecut/report-builders/option-collision.rb, line 31
def fail_summary
  "Multiple options assign the same values to be rendered"
end
report_fields() click to toggle source
# File lib/diecut/report-builders/option-collision.rb, line 12
def report_fields
  ["Output target", "Option name", "Source plugin"]
end
report_name() click to toggle source
# File lib/diecut/report-builders/option-collision.rb, line 8
def report_name
  "Option collisions"
end