class RubyAudit::Database

Public Instance Methods

advisories_for(name, type) { |load| ... } click to toggle source
# File lib/ruby_audit/database.rb, line 5
def advisories_for(name, type)
  return enum_for(__method__, name, type) unless block_given?

  each_advisory_path_for(name, type) do |path|
    yield Bundler::Audit::Advisory.load(path)
  end
end
check(object, type = 'gems') { |advisory| ... } click to toggle source
# File lib/ruby_audit/database.rb, line 21
def check(object, type = 'gems')
  return enum_for(__method__, object, type) unless block_given?

  advisories_for(object.name, type) do |advisory|
    yield advisory if advisory.vulnerable?(object.version)
  end
end
check_ruby(ruby, &block) click to toggle source
# File lib/ruby_audit/database.rb, line 13
def check_ruby(ruby, &block)
  check(ruby, 'rubies', &block)
end
check_rubygems(rubygems, &block) click to toggle source
# File lib/ruby_audit/database.rb, line 17
def check_rubygems(rubygems, &block)
  check(rubygems, 'gems', &block)
end

Protected Instance Methods

each_advisory_path(&block) click to toggle source
# File lib/ruby_audit/database.rb, line 31
def each_advisory_path(&block)
  Dir.glob(File.join(@path, '{gems,rubies}', '*', '*.yml'), &block)
end
each_advisory_path_for(name, type = 'gems', &block) click to toggle source
# File lib/ruby_audit/database.rb, line 35
def each_advisory_path_for(name, type = 'gems', &block)
  Dir.glob(File.join(@path, type, name, '*.yml'), &block)
end