Sha256: 36ac1a4c3d5722c396adeeda82296b8ede5879c3d67b65281ce86772c3b0c8a0

Contents?: true

Size: 459 Bytes

Versions: 1

Compression:

Stored size: 459 Bytes

Contents

module Owners
  class Config
    attr_reader :root

    def initialize(file)
      @config = File.read(file)
      @root = File.dirname(file)
    end

    def owners
      subscriptions.each_with_object({}) do |line, hash|
        owner, path = line.split(/\s+/, 2).push('.*')
        hash[owner] ||= []
        hash[owner] << Regexp.new(path)
      end
    end

    private

    def subscriptions
      @config.split("\n").reject(&:empty?)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
owners-0.0.0 lib/owners/config.rb