class OpenSCAP::Xccdf::Tailoring

Attributes

raw[R]

Public Class Methods

new(source, benchmark) click to toggle source
# File lib/openscap/xccdf/tailoring.rb, line 11
def initialize(source, benchmark)
  case source
  when OpenSCAP::Source
    @raw = OpenSCAP.xccdf_tailoring_import_source source.raw, benchmark
  else
    raise OpenSCAP::OpenSCAPError, "Cannot initialize #{self.class.name} with '#{source}'"
  end
  OpenSCAP.raise! if @raw.null?
end

Public Instance Methods

destroy() click to toggle source
# File lib/openscap/xccdf/tailoring.rb, line 25
def destroy
  OpenSCAP.xccdf_tailoring_free @raw
  @raw = nil
end
profiles() click to toggle source
# File lib/openscap/xccdf/tailoring.rb, line 21
def profiles
  @profiles ||= profiles_init
end

Private Instance Methods

profiles_init() click to toggle source
# File lib/openscap/xccdf/tailoring.rb, line 32
def profiles_init
  profiles = {}
  profit = OpenSCAP.xccdf_tailoring_get_profiles raw
  while OpenSCAP.xccdf_profile_iterator_has_more profit
    profile_p = OpenSCAP.xccdf_profile_iterator_next profit
    profile = OpenSCAP::Xccdf::Profile.new profile_p
    profiles[profile.id] = profile
  end
  OpenSCAP.xccdf_profile_iterator_free profit
  profiles
end