Module: Map::Sequential

Defined in:
app/models/map.rb

Class Method Summary collapse

Class Method Details

.location_from_index(index, size) ⇒ Object


137
138
139
140
# File 'app/models/map.rb', line 137

def self.location_from_index(index, size)
  digit_count = Math.log10(size + 1).ceil
  "S%0#{digit_count}d" % [index + 1]
end

.location_from_row_and_column(row, column, width, size) ⇒ Object


132
133
134
135
# File 'app/models/map.rb', line 132

def self.location_from_row_and_column(row, column, width, size)
  digit_count = Math.log10(size + 1).ceil
  "S%0#{digit_count}d" % [(row) * width + column]
end