Class: Geostats::Views::DifficultyTerrainMatrix
- Defined in:
- lib/geostats/views/difficulty_terrain_matrix.rb
Constant Summary collapse
- STEPS =
[1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
Instance Method Summary collapse
-
#initialize ⇒ DifficultyTerrainMatrix
constructor
A new instance of DifficultyTerrainMatrix.
- #matrix ⇒ Object
- #tsums ⇒ Object
Constructor Details
#initialize ⇒ DifficultyTerrainMatrix
Returns a new instance of DifficultyTerrainMatrix.
6 7 8 |
# File 'lib/geostats/views/difficulty_terrain_matrix.rb', line 6 def initialize @matrix = Stats.difficulty_terrain_matrix end |
Instance Method Details
#matrix ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/geostats/views/difficulty_terrain_matrix.rb', line 10 def matrix difficulties = STEPS.reverse @matrix.map do |row| hash = { :difficulty => difficulties.pop, :dsum => row.sum, } STEPS.length.times do |i| hash["t#{STEPS[i].to_s.gsub(".", "")}"] = row[i] > 0 ? row[i] : nil end hash end end |