Class: AUCoreTestKit::Generator::SuiteGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/au_core_test_kit/generator/suite_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ig_metadata, base_output_dir) ⇒ SuiteGenerator

Returns a new instance of SuiteGenerator.



17
18
19
20
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 17

def initialize(, base_output_dir)
  self. = 
  self.base_output_dir = base_output_dir
end

Instance Attribute Details

#base_output_dirObject

Returns the value of attribute base_output_dir.



15
16
17
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 15

def base_output_dir
  @base_output_dir
end

#ig_metadataObject

Returns the value of attribute ig_metadata.



15
16
17
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 15

def 
  
end

Class Method Details

.generate(ig_metadata, base_output_dir) ⇒ Object



10
11
12
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 10

def generate(, base_output_dir)
  new(, base_output_dir).generate
end

Instance Method Details

#base_output_file_nameObject



34
35
36
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 34

def base_output_file_name
  'au_core_test_suite.rb'
end

#capability_statement_file_nameObject



93
94
95
96
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 93

def capability_statement_file_name
  # "../../custom_groups/#{ig_metadata.ig_version}/capability_statement_group"
  '../../custom_groups/v0.3.0-ballot/capability_statement_group'
end

#capability_statement_group_idObject



98
99
100
101
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 98

def capability_statement_group_id
  # "au_core_#{ig_metadata.reformatted_version}_capability_statement"
  'au_core_v030_ballot_capability_statement'
end

#class_nameObject



38
39
40
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 38

def class_name
  'AUCoreTestSuite'
end

#fhir_api_group_idObject



54
55
56
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 54

def fhir_api_group_id
  "au_core_#{ig_metadata.reformatted_version}_fhir_api"
end

#generateObject



74
75
76
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 74

def generate
  File.open(output_file_name, 'w') { |f| f.write(output) }
end

#group_file_listObject



88
89
90
91
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 88

def group_file_list
  @group_file_list ||=
    groups.map { |group| group.file_name.delete_suffix('.rb') }
end

#group_id_listObject



83
84
85
86
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 83

def group_id_list
  @group_id_list ||=
    groups.map(&:id)
end

#groupsObject



78
79
80
81
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 78

def groups
  .ordered_groups.compact
             .reject { |group| SpecialCases.exclude_group? group }
end

#ig_identifierObject



62
63
64
65
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 62

def ig_identifier
  version = .ig_version[1..] # Remove leading 'v'
  "hl7.fhir.au.core##{version}"
end


67
68
69
70
71
72
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 67

def ig_link
  case .ig_version
  when 'v0.3.0-ballot'
    'http://hl7.org.au/fhir/core/0.3.0-ballot'
  end
end

#module_nameObject



42
43
44
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 42

def module_name
  "AUCore#{ig_metadata.reformatted_version.upcase}"
end

#outputObject



30
31
32
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 30

def output
  @output ||= ERB.new(template).result(binding)
end

#output_file_nameObject



46
47
48
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 46

def output_file_name
  File.join(base_output_dir, base_output_file_name)
end

#suite_idObject



50
51
52
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 50

def suite_id
  "au_core_#{ig_metadata.reformatted_version}"
end

#templateObject



26
27
28
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 26

def template
  @template ||= File.read(File.join(__dir__, 'templates', 'suite.rb.erb'))
end

#titleObject



58
59
60
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 58

def title
  "AU Core #{ig_metadata.ig_version}"
end

#version_specific_message_filtersObject



22
23
24
# File 'lib/au_core_test_kit/generator/suite_generator.rb', line 22

def version_specific_message_filters
  []
end