Class: DaVinciUSDrugFormularyTestKit::Generator::SuiteGenerator
- Inherits:
-
Object
- Object
- DaVinciUSDrugFormularyTestKit::Generator::SuiteGenerator
- Defined in:
- lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb
Instance Attribute Summary collapse
-
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
-
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
Class Method Summary collapse
Instance Method Summary collapse
- #base_output_file_name ⇒ Object
- #capability_statement_file_name ⇒ Object
- #capability_statement_group_id ⇒ Object
- #class_name ⇒ Object
- #generate ⇒ Object
- #group_file_list ⇒ Object
- #group_id_list ⇒ Object
- #groups ⇒ Object
- #ig_identifier ⇒ Object
- #ig_link ⇒ Object
-
#initialize(ig_metadata, base_output_dir) ⇒ SuiteGenerator
constructor
A new instance of SuiteGenerator.
- #module_name ⇒ Object
- #output ⇒ Object
- #output_file_name ⇒ Object
- #short_title ⇒ Object
- #suite_id ⇒ Object
- #template ⇒ Object
- #title ⇒ Object
- #version_specific_message_filters ⇒ Object
Constructor Details
#initialize(ig_metadata, base_output_dir) ⇒ SuiteGenerator
Returns a new instance of SuiteGenerator.
14 15 16 17 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 14 def initialize(, base_output_dir) self. = self.base_output_dir = base_output_dir end |
Instance Attribute Details
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
12 13 14 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 12 def base_output_dir @base_output_dir end |
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
12 13 14 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 12 def @ig_metadata end |
Class Method Details
.generate(ig_metadata, base_output_dir) ⇒ Object
7 8 9 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 7 def generate(, base_output_dir) new(, base_output_dir).generate end |
Instance Method Details
#base_output_file_name ⇒ Object
31 32 33 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 31 def base_output_file_name 'usdf_test_suite.rb' end |
#capability_statement_file_name ⇒ Object
86 87 88 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 86 def capability_statement_file_name "../../custom_groups/#{.ig_version}/capability_statement_group" end |
#capability_statement_group_id ⇒ Object
90 91 92 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 90 def capability_statement_group_id "usdf_#{.reformatted_version}_capability_statement" end |
#class_name ⇒ Object
35 36 37 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 35 def class_name 'USDFTestSuite' end |
#generate ⇒ Object
68 69 70 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 68 def generate File.write(output_file_name, output) end |
#group_file_list ⇒ Object
81 82 83 84 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 81 def group_file_list @group_file_list ||= groups.map { |group| group.file_name.delete_suffix('.rb') } end |
#group_id_list ⇒ Object
76 77 78 79 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 76 def group_id_list @group_id_list ||= groups.map(&:id) end |
#groups ⇒ Object
72 73 74 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 72 def groups .ordered_groups end |
#ig_identifier ⇒ Object
59 60 61 62 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 59 def ig_identifier version = .ig_version[1..] # Remove leading 'v' "hl7.fhir.us.davinci-drug-formulary##{version}" end |
#ig_link ⇒ Object
64 65 66 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 64 def ig_link 'https://hl7.org/fhir/us/davinci-drug-formulary/STU2.0.1/' end |
#module_name ⇒ Object
39 40 41 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 39 def module_name "USDF#{.reformatted_version.upcase}" end |
#output ⇒ Object
27 28 29 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 27 def output @output ||= ERB.new(template).result(binding) end |
#output_file_name ⇒ Object
43 44 45 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 43 def output_file_name File.join(base_output_dir, base_output_file_name) end |
#short_title ⇒ Object
55 56 57 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 55 def short_title "US Drug Formulary #{.ig_version}" end |
#suite_id ⇒ Object
47 48 49 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 47 def suite_id "davinci_us_drug_formulary_#{.reformatted_version}" end |
#template ⇒ Object
23 24 25 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 23 def template @template ||= File.read(File.join(__dir__, 'templates', 'suite.rb.erb')) end |
#title ⇒ Object
51 52 53 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 51 def title "DaVinci US Drug Formulary #{.ig_version}" end |
#version_specific_message_filters ⇒ Object
19 20 21 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 19 def [] end |