lib/gemsurance/vulnerability.rb
require 'yaml'
module Gemsurance
class Vulnerability
def initialize(yaml)
@attributes = YAML.load(yaml)
end
attr_reader :attributes
ATTRIBUTES = [:gem, :framework, :cve, :osvdb, :url, :title, :description, :date, :cvss_v2, :patched_versions, :unaffected_versions].freeze
ATTRIBUTES.each do |attr|
define_method(attr) do
@attributes[attr.to_s]
end
end
def ==(other)
@attributes == other.attributes
end
end
end