Class: Geostats::Views::Milestones

Inherits:
Base
  • Object
show all
Defined in:
lib/geostats/views/milestones.rb

Instance Method Summary collapse

Constructor Details

#initializeMilestones

Returns a new instance of Milestones.



4
5
6
# File 'lib/geostats/views/milestones.rb', line 4

def initialize
  @milestones = Stats.milestones
end

Instance Method Details

#milestonesObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/geostats/views/milestones.rb', line 8

def milestones
  @milestones.map do |milestone|
    {
      :milestone  => milestone[:milestone],
      :name       => milestone[:log].cache.name,
      :type       => milestone[:log].cache.cache_type.name,
      :cache_url  => url_for_cache(milestone[:log].cache),
      :log_url    => url_for_log(milestone[:log]),
      :date       => milestone[:log].logged_at.strftime("%F"),
      :distance   => milestone[:distance] ? milestone[:distance].to_i : nil
    }
  end
end