Module: Map::Sequential

Defined in:
app/models/map.rb

Overview

rubocop:todo Style/Documentation

Class Method Summary collapse

Class Method Details

.location_from_index(index, size) ⇒ Object


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

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


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

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