Skip to content

Instantly share code, notes, and snippets.

@amarkpark
Last active May 28, 2016 01:39
Show Gist options
  • Save amarkpark/d6570856b3531c475513 to your computer and use it in GitHub Desktop.
Save amarkpark/d6570856b3531c475513 to your computer and use it in GitHub Desktop.
class Coffee
attr_accessor :brew
def initialize(brew)
@brew = brew.upcase.chr # accounts for multiple cases, spellings & typos
if @brew == "R"
@brew = "Regular"
puts "Mmm... Dark rich fully-leaded goodness!"
elsif @brew == "D"
@brew = "Decaf"
puts "Finest decaf in the state, coming right up!"
end
end
def refill
puts "Regular or Decaf?"
Coffee.new("#{gets.chomp}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment