Class: Utility::CommonDilutionCalculations::Compressor

Inherits:
Object
  • Object
show all
Defined in:
app/models/utility/common_dilution_calculations.rb

Overview

Class used by calculators that need to compress wells to top left. Handles the determination of the next well location.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number_of_rows) ⇒ Compressor

Sets up an instance of the Compressor class for a plate.

Parameters:

  • number_of_rows (int)

    Number of rows on the plate.



240
241
242
243
244
245
# File 'app/models/utility/common_dilution_calculations.rb', line 240

def initialize(number_of_rows)
  @number_of_rows = number_of_rows
  @row = 0
  @column = 0
  validate_initial_arguments
end

Instance Attribute Details

#columnObject

Returns the value of attribute column.



233
234
235
# File 'app/models/utility/common_dilution_calculations.rb', line 233

def column
  @column
end

#rowObject

Returns the value of attribute row.



233
234
235
# File 'app/models/utility/common_dilution_calculations.rb', line 233

def row
  @row
end

Instance Method Details

#next_well_locationObject

Work out what the next well location will be. This depends on whether we are in the last row of the plate and will need to start a new column. NB. rows and columns are zero-based here.

Returns:

  • nothing Sets the next row and column in the Compressor instance.



254
255
256
# File 'app/models/utility/common_dilution_calculations.rb', line 254

def next_well_location
  determine_next_available_location
end