Class: InspecTools::CSVTool

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

Overview

Methods for converting from CSV to various formats

Instance Method Summary collapse

Constructor Details

#initialize(csv, mapping, name, verbose = false) ⇒ CSVTool

Returns a new instance of CSVTool.



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

def initialize(csv, mapping, name, verbose = false)
  @name = name
  @csv = csv
  @mapping = mapping
  @verbose = verbose
  @csv.shift if @mapping['skip_csv_header']
end

Instance Method Details

#to_cklObject



24
25
26
# File 'lib/inspec_tools/csv.rb', line 24

def to_ckl
  # TODO
end

#to_inspecObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/inspec_tools/csv.rb', line 32

def to_inspec
  @controls = []
  @cci_xml = nil
  @profile = {}
  read_cci_xml
  
  parse_controls
  @profile['controls'] = @controls
  @profile['sha256'] = Digest::SHA256.hexdigest @profile.to_s
  @profile
end

#to_xccdfObject



28
29
30
# File 'lib/inspec_tools/csv.rb', line 28

def to_xccdf
  # TODO
end