Skip to content

Instantly share code, notes, and snippets.

@mindplace
Created February 27, 2016 00:42
Show Gist options
  • Select an option

  • Save mindplace/6fba36c25a1c2ce3d1b8 to your computer and use it in GitHub Desktop.

Select an option

Save mindplace/6fba36c25a1c2ce3d1b8 to your computer and use it in GitHub Desktop.
if __FILE__ == $PROGRAM_NAME
blogger = MicroBlogger.new
puts "\nWelcome to the JSL Twitter client!"
puts "Available commands:"
puts " q => quit"
puts " dm => direct message "
puts " t => tweet"
puts " g => see all the latest tweets from friends\n\n"
command = ""
commands = {"dm" => "route_dm", "t"=>"tweet", "q"=>"quit",
"g" => "get_all_latest_friends_tweets"}
while command != "quit"
print "Enter command: "
command = commands[gets.chomp]
if blogger.respond_to?(command)
blogger.send(command)
puts
elsif command == "quit"
break
else puts "Sorry, that command is not set!"
end
end
puts "\nThanks for using the JSL Twitter client!\n\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment