Sha256: 4e88b23fe9444a45db98e2be3aaad4676e85049f985c04826baec756471bdfb8

Contents?: true

Size: 589 Bytes

Versions: 3

Compression:

Stored size: 589 Bytes

Contents

module SCSSLint
  class NoSuchLinter < StandardError; end

  module LinterRegistry
    @linters = []

    class << self
      attr_reader :linters

      def included(base)
        @linters << base
      end

      def extract_linters_from(linter_names)
        linter_names.map do |linter_name|
          begin
            linter_class = linter_name.split('_').map(&:capitalize).join('')
            Kernel.const_get(linter_class)
          rescue NameError
            raise NoSuchLinter.new("Linter #{linter_class} does not exist")
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scss-lint-0.6.6 lib/scss_lint/linter_registry.rb
scss-lint-0.6.5 lib/scss_lint/linter_registry.rb
scss-lint-0.6 lib/scss_lint/linter_registry.rb