Class: Csa::Ccm::Matrix::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/csa/ccm/matrix.rb

Constant Summary collapse

ATTRIBS =
%i(
  control_domain_id control_id question_id control_spec
  question_content answer_yes answer_no answer_na notes
  control_domain_description
)

Instance Method Summary collapse

Constructor Details

#initialize(ruby_xl_row) ⇒ Row

Returns a new instance of Row.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/csa/ccm/matrix.rb', line 58

def initialize(ruby_xl_row)
  @control_domain_description = ruby_xl_row[0].value
  @control_id = ruby_xl_row[1].value
  @question_id = ruby_xl_row[2].value
  @control_spec = ruby_xl_row[3].value
  @question_content = ruby_xl_row[4].value
  @answer_yes = ruby_xl_row[5].value
  @answer_no = ruby_xl_row[6].value
  @answer_na = ruby_xl_row[7].value

  # In 3.0.1 2017-09-01, Rows 276 and 277's control ID says "LG-02" but it should be "STA-05" instead.
  @control_id = question_id.split(".").first if question_id
  @control_domain_id = control_id.split("-").first if control_id

  # puts "HERE IN ROW! #{ruby_xl_row.cells.map(&:value)}"

  puts control_domain_description
  puts control_id
  puts question_id

  self
end

Instance Method Details

#control_domain_nameObject



81
82
83
84
85
# File 'lib/csa/ccm/matrix.rb', line 81

def control_domain_name
  return nil if control_domain_description.nil?
  name, _, control_name = control_domain_description.split(/(\n)/)
  name
end

#control_nameObject



87
88
89
90
91
# File 'lib/csa/ccm/matrix.rb', line 87

def control_name
  return nil if control_domain_description.nil?
  name, _, control_name = control_domain_description.split(/(\n)/)
  control_name
end