Sha256: d9a6c5816fbcdaab1b0a9d48b2991a2cf1cb5f29668880890d9d14aede1dace2
Contents?: true
Size: 626 Bytes
Versions: 3
Compression:
Stored size: 626 Bytes
Contents
require 'spanx/helper/exit' module Spanx class Whitelist include Spanx::Helper::Exit attr_accessor :patterns, :filename def initialize(filename) @patterns = [] @filename = filename load_file end def match?(line) @patterns.any? do |p| p.match(line) end end def load_file if filename begin @patterns = ::File.readlines(filename).reject{|line| line =~ /^#/}.map{|p| %r{#{p.chomp()}} } rescue Errno::ENOENT error_exit_with_msg("Unable to find whitelist file at #{filename}") end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spanx-0.3.0 | lib/spanx/whitelist.rb |
spanx-0.1.1 | lib/spanx/whitelist.rb |
spanx-0.1.0 | lib/spanx/whitelist.rb |