Sha256: bbbe16bc33f6e369bf3a25e5dced74b767eca35500e929bfe1d0b4ffb63e378c

Contents?: true

Size: 623 Bytes

Versions: 4

Compression:

Stored size: 623 Bytes

Contents

module Git
  module Conform
    class BaseChecker

      attr_reader :filename

      def initialize(filename)
        @filename = filename
        raise "No such file - #{@filename}" unless File.exist? @filename
        raise "Is a directory - #{@filename}" if File.directory? @filename
      end

      def excluded?
        raise 'SubclassResponsibility'
      end

      def conforms?
        raise 'SubclassResponsibility'
      end

      def check_exclusion
        yield @filename if excluded?
      end

      def check_conformity
        yield @filename unless excluded? || conforms?
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git-conform-1.3.0 lib/git/conform/checkers/base_checker.rb
git-conform-1.2.1 lib/git/conform/checkers/base_checker.rb
git-conform-1.1.0 lib/git/conform/checkers/base_checker.rb
git-conform-1.0.0 lib/git/conform/checkers/base_checker.rb