Class: ONCCertificationG10TestKit::Tasks::TestProcedure::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/onc_certification_g10_test_kit/tasks/test_procedure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Step

Returns a new instance of Step.



35
36
37
38
39
40
41
42
43
44
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 35

def initialize(data)
  @group = data[:group]
  @id = data[:id]
  @s_u_t = data[:SUT]
  @t_l_v = data[:TLV]
  @inferno_supported = data[:inferno_supported]
  @inferno_notes = data[:inferno_notes]
  @alternate_test = data[:alternate_test]
  @inferno_tests = expand_tests(data[:inferno_tests]).flatten
end

Instance Attribute Details

#alternate_testObject

Returns the value of attribute alternate_test.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def alternate_test
  @alternate_test
end

#groupObject

Returns the value of attribute group.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def group
  @group
end

#idObject

Returns the value of attribute id.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def id
  @id
end

#inferno_notesObject

Returns the value of attribute inferno_notes.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def inferno_notes
  @inferno_notes
end

#inferno_supportedObject

Returns the value of attribute inferno_supported.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def inferno_supported
  @inferno_supported
end

#inferno_testsObject

Returns the value of attribute inferno_tests.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def inferno_tests
  @inferno_tests
end

#s_u_tObject

Returns the value of attribute s_u_t.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def s_u_t
  @s_u_t
end

#t_l_vObject

Returns the value of attribute t_l_v.



33
34
35
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 33

def t_l_v
  @t_l_v
end

Instance Method Details

#expand_tests(test_list) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/onc_certification_g10_test_kit/tasks/test_procedure.rb', line 46

def expand_tests(test_list)
  return [] if test_list.nil?

  test_list.map do |test|
    if test.include?(' - ')
      first, second = test.split(' - ')
      prefix, _, beginning = first.rpartition('.')
      second_prefix, _, ending = second.rpartition('.')
      raise "'#{prefix}' != '#{second_prefix}' in #{@group} #{@id}" unless prefix == second_prefix

      (beginning.to_i..ending.to_i).map { |index| "#{prefix}.#{format('%02<index>d', { index: })}" }
    else
      [test]
    end
  end
end