class Inspec::Resources::YumRepo

def enabled?

def enabled?
  repo = info
  return false if repo.nil?
  info['status'] == 'enabled'
end

def exist?

def exist?
  !info.nil?
end

def info

def info
  return @cache if defined?(@cache)
  selection = @yum.repositories.select { |e| e['id'] == @reponame || shortname(e['id']) == @reponame }
  @cache = selection[0] if !selection.nil? && selection.length == 1
  @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