Class: Scaptimony::GuideGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/models/scaptimony/policy.rb

Instance Method Summary collapse

Constructor Details

#initialize(p) ⇒ GuideGenerator

Returns a new instance of GuideGenerator.



14
15
16
17
18
19
20
21
22
23
# File 'app/models/scaptimony/policy.rb', line 14

def initialize(p)
  case p
  when Scaptimony::Policy
    @scap_content = p.scap_content
    @profile = p.scap_content_profile
  end
  if @scap_content.nil? or @scap_content.source.nil?
    OpenSCAP.raise! "Cannot generate HTML Guide for #{@scap_content}/#{@profile}"
  end
end

Instance Method Details

#each {|sds.html_guide profile_id| ... } ⇒ Object

Yields:

  • (sds.html_guide profile_id)


25
26
27
28
29
30
31
# File 'app/models/scaptimony/policy.rb', line 25

def each
  sds = OpenSCAP::DS::Sds.new @scap_content.source
  sds.select_checklist
  profile_id = @profile.nil? ? nil : @profile.profile_id
  yield sds.html_guide profile_id
  sds.destroy
end