Class: OpenSCAP::Xccdf::Reference

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

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Reference

Returns a new instance of Reference.



15
16
17
18
19
# File 'lib/openscap/xccdf/reference.rb', line 15

def initialize(raw)
  raise OpenSCAP::OpenSCAPError, "Cannot initialize #{self.class.name} with '#{raw}'" \
    unless raw.is_a?(FFI::Pointer)
  @raw = raw
end

Instance Method Details

#hrefObject



25
26
27
# File 'lib/openscap/xccdf/reference.rb', line 25

def href
  OpenSCAP.oscap_reference_get_href(@raw)
end


29
30
31
# File 'lib/openscap/xccdf/reference.rb', line 29

def html_link
  "<a href='#{href}'>#{title}</a>"
end

#titleObject



21
22
23
# File 'lib/openscap/xccdf/reference.rb', line 21

def title
  OpenSCAP.oscap_reference_get_title(@raw)
end

#to_hashObject



33
34
35
36
37
38
39
# File 'lib/openscap/xccdf/reference.rb', line 33

def to_hash
  {
    :title => title,
    :href => href,
    :html_link => html_link
  }
end