class Diecut::Linter

Attributes

mill[R]

Public Class Methods

new(mill) click to toggle source
# File lib/diecut/linter.rb, line 11
def initialize(mill)
  @mill = mill
end

Public Instance Methods

each_default() { |default, plugin| ... } click to toggle source
# File lib/diecut/linter.rb, line 44
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/linter.rb, line 52
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/linter.rb, line 38
def each_plugin
  mill.mediator.activated_plugins.each do |plugin|
    yield plugin
  end
end
report() click to toggle source
# File lib/diecut/linter.rb, line 16
def report
  @ui = mill.user_interface

  reports = ReportBuilder.all_kinds.map do |kind|
    kind.new(mill).go
  end
  if Diecut.issue_handler.respond_to?(:reports)
    reports += Diecut.issue_handler.reports
  end
  formatter = ReportFormatter.new( reports)
  formatter.to_s
end
unindent(text) click to toggle source

Needed: Overridden option defaults (without plugin dep) Option with default, context with default (w/o PD)

# File lib/diecut/linter.rb, line 33
def unindent(text)
  indent = text.scan(/(^[ \t]*)\S/).map{|cap| cap.first}.max_by(&:length)
  text.gsub(%r{^#{indent}},'')
end