Sha256: b4dfa9dac8e5472c22b157371c5741582b15a59dc6c23475a0657165ff5d5f8f
Contents?: true
Size: 970 Bytes
Versions: 13
Compression:
Stored size: 970 Bytes
Contents
# frozen_string_literal: true module SlimLint class NoSuchLinter < StandardError; end # Stores all defined linters. module LinterRegistry @linters = [] class << self # List of all registered linters. attr_reader :linters # Executed when a linter includes the {LinterRegistry} module. # # This results in the linter being registered with the registry. # # @param subclass [Class] def included(subclass) @linters << subclass end # Return a list of {SlimLint::Linter} {Class}es corresponding to the # specified list of names. # # @param linter_names [Array<String>] # @return [Array<Class>] def extract_linters_from(linter_names) linter_names.map do |linter_name| SlimLint::Linter.const_get(linter_name) rescue NameError raise NoSuchLinter, "Linter #{linter_name} does not exist" end end end end end
Version data entries
13 entries across 13 versions & 2 rubygems