Class: FlexStationData::Wells

Inherits:
Object
  • Object
show all
Defined in:
lib/flex_station_data/wells.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matrix) ⇒ Wells

Returns a new instance of Wells.



9
10
11
# File 'lib/flex_station_data/wells.rb', line 9

def initialize(matrix)
  @matrix = matrix
end

Instance Attribute Details

#matrixObject (readonly)

Returns the value of attribute matrix.



7
8
9
# File 'lib/flex_station_data/wells.rb', line 7

def matrix
  @matrix
end

Instance Method Details

#coordinates(well_label) ⇒ Object



17
18
19
20
21
22
# 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) ⇒ Object



13
14
15
# File 'lib/flex_station_data/wells.rb', line 13

def values(well_label)
  matrix[*coordinates(well_label)]
end