Class: PlateWalking::Walker::Location

Inherits:
Object
  • Object
show all
Defined in:
app/models/plate_walking.rb

Overview

rubocop:todo Style/Documentation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alphanumeric_location) ⇒ Location

Returns a new instance of Location.



10
11
12
13
14
15
# File 'app/models/plate_walking.rb', line 10

def initialize(alphanumeric_location)
  (match = /^([A-Z])(\d+)$/.match(alphanumeric_location)) ||
    raise(StandardError, "Invalid well location #{alphanumeric_location.inspect}")
  @row = match[1]
  @column = match[2].to_i
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



17
18
19
# File 'app/models/plate_walking.rb', line 17

def column
  @column
end

#rowObject (readonly)

Returns the value of attribute row.



17
18
19
# File 'app/models/plate_walking.rb', line 17

def row
  @row
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/models/plate_walking.rb', line 21

def eql?(other)
  to_s.eql?(other.to_s)
end

#to_sObject



25
26
27
# File 'app/models/plate_walking.rb', line 25

def to_s
  "#{row}#{column}"
end