summaryrefslogtreecommitdiff
path: root/config/initializers/extensions.rb
blob: 3dca595ad840c22ac0a969f3a6a694aa7056aab0 (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
class Fixnum
  def lbs
    to_f.lbs
  end

  def kg
    to_f.kg
  end
end

class Float
  def lbs
    Quantity.new(self, :lbs)
  end

  def kg
    Quantity.new(self, :kg)
  end
end

class NilClass
  def to(units)
    0.0.lbs.to(units)
  end
end