class Inspec::Resources::YumRepo

def enabled?

def enabled?
  return false unless exist?
  info['status'] == 'enabled'
end

def exist?

def exist?
  !info.empty?
end

def info

def info
  return @cache if defined?(@cache)
  selection = @yum.repositories.select { |e| e['id'] == @reponame || shortname(e['id']) == @reponame }
  @cache = selection.empty? ? {} : selection.first
  @cache
end

def initialize(yum, reponame)

def initialize(yum, reponame)
  @yum = yum
  @reponame = reponame
end

def shortname(id)

e.g. extras/7/x86_64 -> extras
extracts the shortname from a repo id
def shortname(id)
  val = %r{^\s*([^/]*?)/(.*?)\s*$}.match(id)
  val.nil? ? nil : val[1]
end

def to_s

def to_s
  "YumRepo #{@reponame}"
end