Module: Twtr::Screen::InstanceMethods
- Defined in:
- lib/twtr/screen.rb
Instance Method Summary collapse
- #puts_user_and_location(e) ⇒ Object
- #show_friends ⇒ Object
- #show_friends_timeline ⇒ Object
- #show_help(opt) ⇒ Object
- #show_public_timeline ⇒ Object
- #show_rate_limit_status ⇒ Object
- #show_replies ⇒ Object
- #show_status ⇒ Object
- #show_update ⇒ Object
- #show_update_location ⇒ Object
- #show_user_timeline ⇒ Object
Instance Method Details
#puts_user_and_location(e) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/twtr/screen.rb', line 53 def puts_user_and_location(e) text = "#{e.elements['screen_name'].text}" location = "#{e.elements['location'].text}" text += " (#{location})" unless location.empty? puts_with_enc text end |
#show_friends ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/twtr/screen.rb', line 24 def show_friends() doc = REXML::Document.new(@source) return if(!doc || !doc.elements['users']) count = 0 doc.elements['users'].each_element do |e| puts_user_and_location(e) break if((count+=1) >= @display_count) end puts "" end |
#show_friends_timeline ⇒ Object
7 |
# File 'lib/twtr/screen.rb', line 7 def show_friends_timeline() show_status(); end |
#show_help(opt) ⇒ Object
60 61 62 |
# File 'lib/twtr/screen.rb', line 60 def show_help(opt) puts "\n#{Twtr::DESCRIPTION}\n#{opt}" end |
#show_public_timeline ⇒ Object
6 |
# File 'lib/twtr/screen.rb', line 6 def show_public_timeline() show_status(); end |
#show_rate_limit_status ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/twtr/screen.rb', line 35 def show_rate_limit_status() doc = REXML::Document.new(@source) return if(!doc || !doc.elements['hash']) remain = doc.elements['hash/remaining-hits'].text limit = doc.elements['hash/hourly-limit'].text puts "#{remain}/#{limit}" end |
#show_replies ⇒ Object
9 |
# File 'lib/twtr/screen.rb', line 9 def show_replies() show_status(); end |
#show_status ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/twtr/screen.rb', line 12 def show_status() doc = REXML::Document.new(@source) return if(!doc || !doc.elements['statuses']) count = 0 doc.elements['statuses'].each_element do |e| text = e.elements['user/screen_name'].text + ': ' + e.elements['text'].text puts_with_enc text break if((count+=1) >= @display_count) end puts "" end |
#show_update ⇒ Object
10 |
# File 'lib/twtr/screen.rb', line 10 def show_update() show_status(); end |
#show_update_location ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/twtr/screen.rb', line 44 def show_update_location() doc = REXML::Document.new(@source) return if(!doc || !doc.elements['user']) count = 0 e = doc.elements['user'] puts_user_and_location(e) puts "" end |
#show_user_timeline ⇒ Object
8 |
# File 'lib/twtr/screen.rb', line 8 def show_user_timeline() show_status(); end |