Class: OpenSCAP::Xccdf::PolicyModel

Inherits:
Object
  • Object
show all
Defined in:
lib/openscap/xccdf/policy_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(b) ⇒ PolicyModel

Returns a new instance of PolicyModel.



12
13
14
15
16
17
18
19
20
21
# File 'lib/openscap/xccdf/policy_model.rb', line 12

def initialize(b)
  case b
  when OpenSCAP::Xccdf::Benchmark
    @raw = OpenSCAP.xccdf_policy_model_new(b.raw)
  else
    raise OpenSCAP::OpenSCAPError,
          "Cannot initialize OpenSCAP::Xccdf::PolicyModel with '#{b}'"
  end
  OpenSCAP.raise! if @raw.null?
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



10
11
12
# File 'lib/openscap/xccdf/policy_model.rb', line 10

def raw
  @raw
end

Instance Method Details

#destroyObject



27
28
29
30
# File 'lib/openscap/xccdf/policy_model.rb', line 27

def destroy
  OpenSCAP.xccdf_policy_model_free @raw
  @raw = nil
end

#policiesObject



23
24
25
# File 'lib/openscap/xccdf/policy_model.rb', line 23

def policies
  @policies ||= policies_init
end