Skip to content

Instantly share code, notes, and snippets.

@erez-rabih
Created December 8, 2014 06:00
Show Gist options
  • Save erez-rabih/934aed432f4c39b03177 to your computer and use it in GitHub Desktop.
Save erez-rabih/934aed432f4c39b03177 to your computer and use it in GitHub Desktop.
When no to use attr_reader and attr_writer in ruby
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