Class: CarinForBlueButtonTestKit::Generator::SuiteGenerator
- Inherits:
-
Object
- Object
- CarinForBlueButtonTestKit::Generator::SuiteGenerator
- Defined in:
- lib/carin_for_blue_button_test_kit/generator/suite_generator.rb
Instance Attribute Summary collapse
-
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
-
#ig_file_name ⇒ Object
Returns the value of attribute ig_file_name.
-
#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_link ⇒ Object
- #ig_relative_path ⇒ Object
-
#initialize(ig_metadata, base_output_dir, ig_file_name) ⇒ SuiteGenerator
constructor
A new instance of SuiteGenerator.
- #module_name ⇒ Object
- #output ⇒ Object
- #output_file_name ⇒ Object
- #smart_launch_file_name ⇒ Object
- #smart_launch_group_id ⇒ Object
- #suite_id ⇒ Object
- #template ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(ig_metadata, base_output_dir, ig_file_name) ⇒ SuiteGenerator
Returns a new instance of SuiteGenerator.
14 15 16 17 18 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 14 def initialize(, base_output_dir, ig_file_name) self. = self.base_output_dir = base_output_dir self.ig_file_name = ig_file_name end |
Instance Attribute Details
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
12 13 14 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 12 def base_output_dir @base_output_dir end |
#ig_file_name ⇒ Object
Returns the value of attribute ig_file_name.
12 13 14 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 12 def ig_file_name @ig_file_name end |
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
12 13 14 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 12 def @ig_metadata end |
Class Method Details
.generate(ig_metadata, base_output_dir, ig_file_name) ⇒ Object
7 8 9 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 7 def generate(, base_output_dir, ig_file_name) new(, base_output_dir, ig_file_name).generate end |
Instance Method Details
#base_output_file_name ⇒ Object
28 29 30 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 28 def base_output_file_name "c4bb_test_suite.rb" end |
#capability_statement_file_name ⇒ Object
85 86 87 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 85 def capability_statement_file_name "../capability_statement/capability_statement_group" end |
#capability_statement_group_id ⇒ Object
89 90 91 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 89 def capability_statement_group_id "c4bb_#{.reformatted_version}_capability_statement" end |
#class_name ⇒ Object
32 33 34 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 32 def class_name "C4BBTestSuite" end |
#generate ⇒ Object
67 68 69 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 67 def generate File.open(output_file_name, 'w') { |f| f.write(output) } end |
#group_file_list ⇒ Object
80 81 82 83 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 80 def group_file_list @group_file_list ||= groups.map { |group| group.file_name.delete_suffix('.rb') } end |
#group_id_list ⇒ Object
75 76 77 78 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 75 def group_id_list @group_id_list ||= groups.select.map(&:id) end |
#groups ⇒ Object
71 72 73 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 71 def groups .ordered_groups.select { |group| group.id.present? } end |
#ig_link ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 56 def ig_link case .ig_version when 'v1.1.0' 'http://hl7.org/fhir/us/carin-bb/STU1.1' when 'v2.0.0' 'http://hl7.org/fhir/us/carin-bb/STU2' else 'http://hl7.org/fhir/us/carin-bb/history.html' end end |
#ig_relative_path ⇒ Object
52 53 54 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 52 def ig_relative_path "igs/#{File.basename(ig_file_name)}" end |
#module_name ⇒ Object
36 37 38 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 36 def module_name "CARIN4BB#{.reformatted_version.upcase}" end |
#output ⇒ Object
24 25 26 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 24 def output @output ||= ERB.new(template).result(binding) end |
#output_file_name ⇒ Object
40 41 42 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 40 def output_file_name File.join(base_output_dir, base_output_file_name) end |
#smart_launch_file_name ⇒ Object
93 94 95 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 93 def smart_launch_file_name "../../custom_groups/#{.ig_version}/c4bb_smart_launch_group" end |
#smart_launch_group_id ⇒ Object
97 98 99 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 97 def smart_launch_group_id "c4bb_#{.reformatted_version}_smart_launch" end |
#suite_id ⇒ Object
44 45 46 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 44 def suite_id "c4bb_#{.reformatted_version}" end |
#template ⇒ Object
20 21 22 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 20 def template @template ||= File.read(File.join(__dir__, 'templates', 'suite.rb.erb')) end |
#title ⇒ Object
48 49 50 |
# File 'lib/carin_for_blue_button_test_kit/generator/suite_generator.rb', line 48 def title "CARIN IG for Blue ButtonĀ® #{.ig_version}" end |