Last active
April 10, 2016 00:23
-
-
Save JosephLeon/73117140f098eef7e80a0cac2fde94b8 to your computer and use it in GitHub Desktop.
This file contains 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 | |
def initialize(chanring, cog) | |
@chainring = chainring | |
@cog = cog | |
end | |
def ratio | |
chainring / cog.to_f | |
end | |
end | |
puts Gear.new(52, 11).ratio | |
## ERROR | |
init.rb:9:in `ratio': undefined method `/' for nil:NilClass (NoMethodError) | |
from init.rb:13:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment