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 ratio chainring / cog.to_f end def gear_inches ratio*(rim+(tire*2)) end end Gear.new(52, 11, 26, 1.5).gear_inches #=> 137.09.. Gear.new(52, 11)).ratio #=> error
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