Class: InspecTools::PDF

Inherits:
Object show all
Defined in:
lib/inspec_tools/pdf.rb

Instance Method Summary collapse

Constructor Details

#initialize(pdf, profile_name, debug = false) ⇒ PDF

Returns a new instance of PDF.

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
# File 'lib/inspec_tools/pdf.rb', line 11

def initialize(pdf, profile_name, debug = false)
  raise ArgumentError if pdf.nil?

  @pdf = pdf
  @name = profile_name
  @debug = debug
end

Instance Method Details

#to_cklObject



46
47
48
# File 'lib/inspec_tools/pdf.rb', line 46

def to_ckl
  # TODO: to_ckl
end

#to_csvObject



38
39
40
# File 'lib/inspec_tools/pdf.rb', line 38

def to_csv
  # TODO: to_csv
end

#to_inspecObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/inspec_tools/pdf.rb', line 19

def to_inspec
  @controls = []
  @csv_handle = nil
  @cci_xml = nil
  @nist_mapping = Utils::CisToNist.get_mapping('cis_to_nist_critical_controls')
  @pdf_text = ''
  @clean_text = ''
  @transformed_data = ''
  @profile = {}
  read_pdf
  @title ||= extract_title
  clean_pdf_text
  transform_data
  
  @profile['controls'] = parse_controls
  @profile['sha256'] = Digest::SHA256.hexdigest @profile.to_s
  @profile
end

#to_xccdfObject



42
43
44
# File 'lib/inspec_tools/pdf.rb', line 42

def to_xccdf
  # TODO: to_xccdf
end