aboutsummaryrefslogtreecommitdiffstats
path: root/lib/way_cost.rb
blob: 5de64177f22cbdf8bae28e68ce498ee7aee1f045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class WayCost
  attr_reader :departure, :arrival
  attr_accessor :distance, :time

  def initialize(
    departure:,
    arrival:,
    distance: nil,
    time: nil,
    id: nil  # TODO: calculate ID automatically
  )
    @departure = departure
    @arrival = arrival
    @distance = distance
    @time = time
    @id = id
  end

  def ==(other)
    other.is_a?(self.class) &&
      @departure == other.departure &&
      @arrival == other.arrival &&
      @distance == other.distance &&
      @time == other.time
  end
end