Sha256: 23ee279cf29cfc512e6e636be0386f0bb818387932062a9eef8bb0f0a6f4a4fb
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
module ROM module Lint # Base class for building linters that check source code # # Linters are used by authors of ROM adapters to verify that their # integration complies with the ROM api. # # Most of the time, authors won't need to construct linters directly # because the provided test helpers will automatically run when required # in tests and specs. # # @example # require 'rom/lint/spec' # # # @api public class Linter # A failure raised by +complain+ Failure = Class.new(StandardError) # Iterate over all lint methods # # @yield [String, ROM::Lint] # # @api public def self.each_lint return to_enum unless block_given? lints.each { |lint| yield lint, self } end # Run a lint method # # @param [String] name # # @raise [ROM::Lint::Linter::Failure] if linting fails # # @api public def lint(name) public_send name true # for assertions end private # Return a list a lint methods # # @return [String] # # @api private def self.lints public_instance_methods(true).grep(/^lint_/).map(&:to_s) end # Raise a failure if a lint verification fails # # @raise [ROM::Lint::Linter::Failure] # # @api private def complain(*args) raise Failure, *args end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rom-0.6.0.beta2 | lib/rom/lint/linter.rb |
rom-0.6.0.beta1 | lib/rom/lint/linter.rb |