Sha256: 43650e8571b5e94bd4a3aa22932d350b29962510a7cff89328f5ee19f5b7f75a
Contents?: true
Size: 1007 Bytes
Versions: 1
Compression:
Stored size: 1007 Bytes
Contents
module Owners # Represents a single OWNERS file. # # It parses OWNERS files and returns an array of # {Subscription} objects is returned for a specified # file path. # # @api private class Config attr_reader :file, :root def self.for(configs) configs.map do |file, contents| new(file, contents) end end def initialize(file, contents = nil) @file = file.to_s @contents = contents || file.read @root = File.dirname(@file) end def subscriptions(path) search do |subscription, results| if subscription.subscribed?(path) results << subscription end end end private def search(&block) attempts .reject(&:metadata?) .each_with_object([], &block) end def attempts lines.map.with_index do |subscription, index| Subscription.new(subscription, index + 1, self) end end def lines @contents.split("\n") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
owners-0.0.9 | lib/owners/config.rb |