Skip to content

Instantly share code, notes, and snippets.

@sskirby
Created June 13, 2013 03:37
Show Gist options
  • Save sskirby/5771089 to your computer and use it in GitHub Desktop.
Save sskirby/5771089 to your computer and use it in GitHub Desktop.
Gear class from Sandi Metz's "The Magic Tricks of Testing"
class Gear
attr_reader :chainring, :cog, :wheel
def initialize(args)
# ...
end
def gear_inches
ratio * wheel.diameter
end
private
def ratio
chainring / cog.to_f
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment