Sha256: 62ef73c908d6dc382dee51e1c11bbcdcf14adff5b8729df00ec182eea3f856e1
Contents?: true
Size: 542 Bytes
Versions: 1
Compression:
Stored size: 542 Bytes
Contents
# frozen_string_literal: true require "matrix" module FlexStationData class Wells attr_reader :matrix def initialize(matrix) @matrix = matrix end def values(well_label) matrix[*coordinates(well_label)] end def coordinates(well_label) coordinates_index[well_label] ||= begin row, column = well_label.scan(/\A([A-Z])(\d+)\z/).first [ row.ord - "A".ord, column.to_i - 1 ] end end private def coordinates_index @coordinates_index ||= {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flex-station-data-1.0.2 | lib/flex_station_data/wells.rb |