a
Ruby
code posted
created at 05 May 17:57
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
class Gear attr_reader :chainring, :cog, :rim, :tire def initialize(chainring, cog, rim, tire) @chainring = chainring @cog = cog @rim = rim @tire = tire end def gear_inches ratio * Wheel.new(rim, tire).diameter end def ratio chainring / cog.to_f end end # ~~~~~~ puts Gear.new(52, 11, 26, 1.5).gear_inches |
390 Bytes in 4 ms with coderay