class PistePal::DayPass
Attributes
date[RW]
distance[RW]
lifts[RW]
longest_run[RW]
maximum_speed[RW]
peak_altitude[RW]
resort[RW]
runs[RW]
tallest_run[RW]
total_hours[RW]
trackpoints[RW]
vertical[RW]
Public Class Methods
new(file_content:)
click to toggle source
# File lib/piste_pal/day_pass.rb, line 89 def initialize(file_content:) PistePal::DataServices::GpxDoc.set_instance(file_content) @trackpoints = PistePal::DataServices::Trackpoints.call @date, @resort = PistePal::DataServices::DateAndResort.call @maximum_speed, @peak_altitude = PistePal::DataServices::MaxSpeedAndAltitude.call(trackpoints: @trackpoints) @runs, @lifts = PistePal::DataServices::RunsAndLifts.call(trackpoints: @trackpoints) @distance = PistePal::DataServices::Distance.call(trackpoints: @runs) @vertical = PistePal::DataServices::Vertical.call(trackpoints: @runs) @tallest_run, @longest_run = PistePal::DataServices::TallestAndLongestRun.call(runs: @runs) @total_hours = calculate_total_hours end
purchase(file_content)
click to toggle source
# File lib/piste_pal/day_pass.rb, line 5 def self.purchase file_content new(file_content: file_content) end
Private Instance Methods
calculate_total_hours()
click to toggle source
# File lib/piste_pal/day_pass.rb, line 101 def calculate_total_hours first = @trackpoints.first.time last = @trackpoints.last.time (Time.parse(last) - Time.parse(first)) / 3600 end