Module: Map::Sequential
- Defined in:
- app/models/map.rb
Class Method Summary collapse
- .location_from_index(index, size) ⇒ Object
- .location_from_row_and_column(row, column, width, size) ⇒ Object
Class Method Details
.location_from_index(index, size) ⇒ Object
153 154 155 156 |
# File 'app/models/map.rb', line 153 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
148 149 150 151 |
# File 'app/models/map.rb', line 148 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 |