Skip to content

Instantly share code, notes, and snippets.

@videlais
Created April 14, 2015 02:43
Show Gist options
  • Save videlais/9ddaf28bee30177eb71b to your computer and use it in GitHub Desktop.
Save videlais/9ddaf28bee30177eb71b to your computer and use it in GitHub Desktop.
class Parser
def initalize()
end
public
def parse(input)
case input
when "Dan"
good_response
else
bad_response
end
end
private
def good_response
puts "Looks like your name is Dan. Neat!"
end
def bad_response
puts "You are not a Dan!"
end
end
parser = Parser.new
loop do
puts "Enter your name:"
input = gets.chomp
break if input == "quit"
parser.parse(input)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment