Module: Twtr::Screen::InstanceMethods

Defined in:
lib/twtr/screen.rb

Instance Method Summary collapse

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_friendsObject



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_timelineObject



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_timelineObject



6
# File 'lib/twtr/screen.rb', line 6

def show_public_timeline() show_status(); end

#show_rate_limit_statusObject



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_repliesObject



9
# File 'lib/twtr/screen.rb', line 9

def show_replies() show_status(); end

#show_statusObject



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_updateObject



10
# File 'lib/twtr/screen.rb', line 10

def show_update() show_status(); end

#show_update_locationObject



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_timelineObject



8
# File 'lib/twtr/screen.rb', line 8

def show_user_timeline() show_status(); end