Class: OpenSCAP::Xccdf::Tailoring
- Inherits:
-
Object
- Object
- OpenSCAP::Xccdf::Tailoring
- Defined in:
- lib/openscap/xccdf/tailoring.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(source, benchmark) ⇒ Tailoring
constructor
A new instance of Tailoring.
- #profiles ⇒ Object
Constructor Details
#initialize(source, benchmark) ⇒ Tailoring
Returns a new instance of Tailoring.
11 12 13 14 15 16 17 18 19 |
# 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 |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
9 10 11 |
# File 'lib/openscap/xccdf/tailoring.rb', line 9 def raw @raw end |
Instance Method Details
#destroy ⇒ Object
30 31 32 33 |
# File 'lib/openscap/xccdf/tailoring.rb', line 30 def destroy OpenSCAP.xccdf_tailoring_free @raw @raw = nil end |
#profiles ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/openscap/xccdf/tailoring.rb', line 21 def profiles @profiles ||= {}.tap do |profiles| OpenSCAP._iterate over: OpenSCAP.xccdf_tailoring_get_profiles(@raw), as: 'xccdf_profile' do |pointer| profile = OpenSCAP::Xccdf::Profile.new pointer profiles[profile.id] = profile end end end |