Created
December 8, 2014 06:00
-
-
Save erez-rabih/934aed432f4c39b03177 to your computer and use it in GitHub Desktop.
When no to use attr_reader and attr_writer in ruby
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
def temporary_balance_boost | |
old_balance = balance | |
balance = balance * 2 | |
puts "Your balance is now #{balance}, you have 10 seconds to use it!" | |
sleep 10 | |
balance = old_balance | |
end | |
def temporary_balance_boost | |
old_balance = @balance | |
@balance = @balance * 2 | |
puts "Your balance is now #{@balance}, you have 10 seconds to use it!" | |
sleep 10 | |
@balance = old_balance | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment