Class: Utility::PcrCyclesCsvFileUploadConfigBase

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/utility/pcr_cycles_csv_file_upload_config_base.rb

Overview

Handles the extraction of dilution configuration functions for pcr cycle binning.

Constant Summary collapse

CONFIG_VARIABLES =
{
  input_amount_desired_min: 'to_f',
  input_amount_desired_max: 'to_f',
  sample_volume_min: 'to_f',
  sample_volume_max: 'to_f',
  diluent_volume_min: 'to_f',
  diluent_volume_max: 'to_f',
  pcr_cycles_min: 'to_i',
  pcr_cycles_max: 'to_i'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(csv_file_config) ⇒ PcrCyclesCsvFileUploadConfigBase

Returns a new instance of PcrCyclesCsvFileUploadConfigBase.



21
22
23
24
25
26
# File 'app/models/utility/pcr_cycles_csv_file_upload_config_base.rb', line 21

def initialize(csv_file_config)
  @csv_file_config = csv_file_config
  CONFIG_VARIABLES.each { |k, v| create_method(k) { @csv_file_config[k].send(v) } }

  initialize_pipeline_specific_methods
end

Instance Attribute Details

#csv_file_configObject (readonly)

Returns the value of attribute csv_file_config.



8
9
10
# File 'app/models/utility/pcr_cycles_csv_file_upload_config_base.rb', line 8

def csv_file_config
  @csv_file_config
end

Instance Method Details

#create_method(name, &block) ⇒ Object



32
33
34
# File 'app/models/utility/pcr_cycles_csv_file_upload_config_base.rb', line 32

def create_method(name, &block)
  self.class.send(:define_method, name, &block)
end

#initialize_pipeline_specific_methodsObject



28
29
30
# File 'app/models/utility/pcr_cycles_csv_file_upload_config_base.rb', line 28

def initialize_pipeline_specific_methods
  raise '#initialize_pipeline_specific_methods must be implemented on subclasses'
end

#submit_for_sequencing_valid_valuesObject



36
37
38
# File 'app/models/utility/pcr_cycles_csv_file_upload_config_base.rb', line 36

def submit_for_sequencing_valid_values
  @csv_file_config.fetch(:submit_for_sequencing_valid_values, []).map
end