-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfix.rb
More file actions
44 lines (37 loc) · 1013 Bytes
/
fix.rb
File metadata and controls
44 lines (37 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
module OpenSCAP
module Xccdf
class Fix
def initialize(raw)
raise OpenSCAP::OpenSCAPError, "Cannot initialize #{self.class.name} with '#{raw}'" \
unless raw.is_a?(FFI::Pointer)
@raw = raw
end
def id
OpenSCAP.xccdf_fix_get_id(@raw)
end
def platform
OpenSCAP.xccdf_fix_get_platform(@raw)
end
# system is a reserved word in Rails, so didn't use it
def fix_system
OpenSCAP.xccdf_fix_get_system(@raw)
end
def content
OpenSCAP.xccdf_fix_get_content(@raw)
end
def to_hash
{
id:,
platform:,
system: fix_system,
content:
}
end
end
end
attach_function :xccdf_fix_get_id, [:pointer], :string
attach_function :xccdf_fix_get_platform, [:pointer], :string
attach_function :xccdf_fix_get_system, [:pointer], :string
attach_function :xccdf_fix_get_content, [:pointer], :string
end