class FlexStationData::Wells

Attributes

matrix[R]

Public Class Methods

new(matrix) click to toggle source
# File lib/flex_station_data/wells.rb, line 9
def initialize(matrix)
  @matrix = matrix
end

Public Instance Methods

coordinates(well_label) click to toggle source
# File lib/flex_station_data/wells.rb, line 17
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
values(well_label) click to toggle source
# File lib/flex_station_data/wells.rb, line 13
def values(well_label)
  matrix[*coordinates(well_label)]
end

Private Instance Methods

coordinates_index() click to toggle source
# File lib/flex_station_data/wells.rb, line 26
def coordinates_index
  @coordinates_index ||= {}
end