summaryrefslogtreecommitdiff
path: root/lib/unit.rb
blob: 16e6456d2ca9a1d27ccbde090ef979b84efc64d9 (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
27
28
29
30
31
32
class Unit
  def initialize
    @vested = false
  end

  def *(price)
    price
  end

  def vest_at(price)
    @vested = true
    @vesting_price = price
  end

  def vested?
    @vested
  end
end

class UnvestedUnits
  def from(grant, at_price)
    unvested_units = grant.find_all { |unit| unit.vested? == false }
    grant.value_of(unvested_units, at_price)
  end
end

class VestedUnits
  def from(grant, at_price)
    vested_units = grant.find_all { |unit| unit.vested? }
    grant.value_of(vested_units, at_price)
  end
end