class Secchecker::Config

Attributes

allowed[R]
patterns[R]

Public Class Methods

new(config) click to toggle source
# File lib/secchecker.rb, line 11
def initialize(config)
  @config = config
  @patterns = config_value("patterns", false) || []
  @allowed = config_value("allowed", false) || []
end

Public Instance Methods

match_allowed(line) click to toggle source
# File lib/secchecker.rb, line 29
def match_allowed(line)
  @allowed.each do |pat|
    return pat if pat =~ line
  end
  nil
end
match_patterns(line) click to toggle source
# File lib/secchecker.rb, line 18
    def match_patterns(line)
      begin
        @patterns.each do |pat|
          return pat if pat =~ line
        end
      rescue
#        puts $!
      end
      nil
    end
unmatch_allowd(line) click to toggle source
# File lib/secchecker.rb, line 36
def unmatch_allowd(line)
end

Private Instance Methods

config_value(key, require) click to toggle source
# File lib/secchecker.rb, line 40
def config_value(key, require)
  value = @config[key]
  if require && (value.nil? || value.empty?)
    raise RuntimeError, "{key}: is empty"
  end
  value
end