Sha256: fda776bee8afbcfd2346e6152f82daded10fd43cd25f29715de8f1c0e1352244
Contents?: true
Size: 654 Bytes
Versions: 5
Compression:
Stored size: 654 Bytes
Contents
require "flex_station_data/readings" module FlexStationData class Wells def initialize(plate_readings_matrix) @plate_readings_matrix = plate_readings_matrix end def readings(well_label) well_index[well_label] ||= begin row, column = parse_well_label(well_label) Readings.new(well_label, plate_readings_matrix[row][column]) end end def parse_well_label(well_label) row, column = well_label.scan(/\A([A-Z])(\d+)\z/).first [ row.ord - "A".ord, column.to_i - 1 ] end private def well_index @well_index ||= {} end attr_reader :plate_readings_matrix end end
Version data entries
5 entries across 5 versions & 1 rubygems