Created
June 13, 2013 03:37
-
-
Save sskirby/5771089 to your computer and use it in GitHub Desktop.
Gear class from Sandi Metz's "The Magic Tricks of Testing"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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