Title / Description
Code 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 puts Gear.new(52, 11, Wheel.new(26, 1.5)).gear_inches
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code