a

Ruby code posted
created at 07 May 22:03

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Gear
  attr_reader :chainring, :cog

  def initialize(chainring, cog)
    @chainring = chainring
    @cog = cog
  end

  def ratio
    chainring / cog.to_f
  end
end

Gear.new(52, 11).ratio #=> 4.72..
219 Bytes in 4 ms with coderay