lib/scss_lint/linter_registry.rb in scss-lint-0.5.2 vs lib/scss_lint/linter_registry.rb in scss-lint-0.6
- old
+ new
@@ -1,13 +1,26 @@
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