Created
June 20, 2012 05:06
-
-
Save jackieiscool/2958223 to your computer and use it in GitHub Desktop.
TWITTER RECURSION CONT...
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
require 'jumpstart_auth' | |
class JSTwitter | |
attr_reader :client | |
def initialize | |
puts "Initializing" | |
@client = JumpstartAuth.twitter | |
end | |
def run | |
tweet ("I totally just figured out a way to make my twitter program use recursion and | |
tweet my messages in blocks of 140 characters at a time, not matter how long they are. | |
For all of my friends reading this who are not computer programmers, I'm sorry that | |
makes no since to you, but I'm super excited about it! If you are a very experienced | |
computer programmer, you also may be confused, if you do not remember what it was like | |
to be a beginner, and get excited about doing very simple things.") | |
end | |
def tweet(message) | |
if message.length > 140 | |
remainder = message[140..-1] | |
@client.update(message[0..139]) | |
self.tweet(remainder) | |
else | |
@client.update(message) | |
end | |
end | |
=begin def tweet(message) | |
if message.length > 140 | |
puts "Don't you know how to use twitter....duh." | |
else | |
@client.update(message) | |
end | |
end | |
=end | |
end | |
jst = JSTwitter.new | |
jst.run | |
#jst = JSTwitter.new | |
#jst.tweet("What's up!") | |
def options | |
input = '' | |
while input != 'q' | |
print "gimmi a command['say', 'q']:" | |
input = gets.chomp! | |
if input == "say" | |
print "what chu wanna say?" | |
say_what = gets.chomp! | |
puts say_what | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment