Class: InspecTools::PDF

Inherits:
Object
  • 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)


16
17
18
19
20
21
22
# File 'lib/inspec_tools/pdf.rb', line 16

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



52
53
54
# File 'lib/inspec_tools/pdf.rb', line 52

def to_ckl
  # TODO: to_ckl
end

#to_csvObject



44
45
46
# File 'lib/inspec_tools/pdf.rb', line 44

def to_csv
  # TODO: to_csv
end

#to_inspecObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/inspec_tools/pdf.rb', line 24

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

#to_xccdfObject



48
49
50
# File 'lib/inspec_tools/pdf.rb', line 48

def to_xccdf
  # TODO: to_xccdf
end