Sha256: 6019744ee4b6e553928fd23e6cba0d68020831bb320588cb55eb75cd24d73ab5

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

module LOCat

  #
  class Matcher
    include Enumerable

    #
    def initialize(*config_files)
      @rules = []

      if config_files.empty?
        raise ArgumentError, 'no configuration files'
      end

      config_files.each do |f|
        instance_eval(File.read(f))
      end
    end

    #
    attr :rules

    #
    def match(files, &block)
      @rules << [files, block]
    end

    #
    def each(&block)
      @rules.each(&block)
    end

    #
    def size
      @rules.size
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locat-0.1.2 lib/locat/matcher.rb
locat-0.1.1 lib/locat/matcher.rb
locat-0.1.0 lib/locat/matcher.rb