class ERB::Linter::Task

Attributes

glob[RW]
name[RW]
root[RW]
tmpdir[RW]

Public Class Methods

new(*args) { |self| ... } click to toggle source
# File lib/erb/linter/task.rb, line 8
def initialize(*args, &block)
  @name = args.shift || :erb_linter
  @glob = "**/*.erb"
  @root = Dir.pwd
  @tmpdir = Dir.tmpdir

  yield self

  desc 'Check ERB files for HTML correcteness'
  task(name, *args) do |_, task_args|
    run
  end
end

Private Instance Methods

run() click to toggle source
# File lib/erb/linter/task.rb, line 24
def run
  success = ERB::Linter::Checker.check_files(glob, root: root, tmpdir: tmpdir)

  exit(success)
rescue ERB::Linter::Error => error
  abort error.message
end