Class: DaVinciUSDrugFormularyTestKit::Generator::UrlsGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_dirObject

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_metadataObject

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_nameObject



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

#generateObject



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_nameObject



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

#outputObject



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_nameObject



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_nameObject



29
30
31
# File 'lib/davinci_us_drug_formulary_test_kit/generator/urls_generator.rb', line 29

def suite_class_name
  'USDFTestSuite'
end

#templateObject



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