Sha256: 51fa1a10861ca354458ad05c93dcebefb597e2f02b625b686b5b3b46c8eee7a8
Contents?: true
Size: 734 Bytes
Versions: 4
Compression:
Stored size: 734 Bytes
Contents
module Goodcheck class Config attr_reader :rules def initialize(rules:) @rules = rules end def rules_for_path(path, rules_filter:, &block) if block_given? rules.map do |rule| if rules_filter.empty? || rules_filter.any? {|filter| /\A#{Regexp.escape(filter)}\.?/ =~ rule.id } if rule.globs.empty? [rule, nil] else glob = rule.globs.find {|glob| path.fnmatch?(glob.pattern, File::FNM_PATHNAME) } if glob [rule, glob] end end end end.compact.each(&block) else enum_for(:rules_for_path, path, rules_filter: rules_filter) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
goodcheck-1.0.0 | lib/goodcheck/config.rb |
goodcheck-0.3.0 | lib/goodcheck/config.rb |
goodcheck-0.2.0 | lib/goodcheck/config.rb |
goodcheck-0.1.0 | lib/goodcheck/config.rb |