Class: DaVinciUSDrugFormularyTestKit::Generator::UrlsGenerator
- Inherits:
-
Object
- Object
- DaVinciUSDrugFormularyTestKit::Generator::UrlsGenerator
- Defined in:
- lib/davinci_us_drug_formulary_test_kit/generator/urls_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
- #generate ⇒ Object
-
#initialize(ig_metadata, base_output_dir) ⇒ UrlsGenerator
constructor
A new instance of UrlsGenerator.
- #module_name ⇒ Object
- #output ⇒ Object
- #output_file_name ⇒ Object
- #suite_class_name ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(ig_metadata, base_output_dir) ⇒ UrlsGenerator
Returns a new instance of UrlsGenerator.
12 13 14 15 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 12 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.
10 11 12 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 10 def base_output_dir @base_output_dir end |
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
10 11 12 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 10 def end |
Class Method Details
.generate(ig_metadata, base_output_dir) ⇒ Object
5 6 7 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 5 def generate(, base_output_dir) new(, base_output_dir).generate end |
Instance Method Details
#base_output_file_name ⇒ Object
25 26 27 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 25 def base_output_file_name 'urls.rb' end |
#generate ⇒ Object
41 42 43 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 41 def generate File.write(output_file_name, output) end |
#module_name ⇒ Object
33 34 35 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 33 def module_name "USDF#{ig_metadata.reformatted_version.upcase}" end |
#output ⇒ Object
21 22 23 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 21 def output @output ||= ERB.new(template, trim_mode: '-').result(binding) end |
#output_file_name ⇒ Object
37 38 39 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 37 def output_file_name File.join(base_output_dir, base_output_file_name) end |
#suite_class_name ⇒ Object
29 30 31 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 29 def suite_class_name 'USDFTestSuite' end |
#template ⇒ Object
17 18 19 |
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 17 def template @template ||= File.read(File.join(__dir__, 'templates', 'urls.rb.erb')) end |