Module: Heron::Factories::Concerns::CoordinatesSupport

Included in:
Plate, TubeRack
Defined in:
app/models/heron/factories/concerns/coordinates_support.rb

Overview

A coordinate is the location identifier for a well or tube inside a plate or rack This module adds validation and processing utilities for this type of identifiers. Eg: A01, A1, F12, etc…

Constant Summary collapse

LOCATION_REGEXP =
/[A-Z][0-9]{0,1}[0-9]/

Instance Method Summary collapse

Instance Method Details

#coordinate_valid?(coordinate) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
# File 'app/models/heron/factories/concerns/coordinates_support.rb', line 16

def coordinate_valid?(coordinate)
  return false if coordinate.blank?

  coordinate.match?(LOCATION_REGEXP)
end

#unpad_coordinate(coordinate) ⇒ Object



12
13
14
# File 'app/models/heron/factories/concerns/coordinates_support.rb', line 12

def unpad_coordinate(coordinate)
  Map.strip_description(coordinate.to_s)
end