17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/twterm/user_window.rb', line 17
def refresh_window
@window.clear
if @user.nil?
draw_border
@window.refresh
return
end
@window.bold do
@window.setpos(1, 2)
@window.addstr(@user.name)
@window.setpos(2, 2)
@window.addstr("@#{@user.screen_name}")
end
@window.setpos(4, 2)
@window.addstr("#{@user.statuses_count.format} tweets ".rjust(@window.maxx - 2))
@window.setpos(5, 2)
@window.addstr("#{@user.friends_count.format} following ".rjust(@window.maxx - 2))
@window.setpos(6, 2)
@window.addstr("#{@user.followers_count.format} followers ".rjust(@window.maxx - 2))
@window.setpos(8, 2)
@window.addstr('Location:')
@window.setpos(9, 4)
@window.addstr(@user.location)
@window.setpos(10, 2)
@window.addstr('Website:')
@window.setpos(11, 4)
@window.addstr(@user.website)
@user.description.split_by_width(@window.maxx - 4).each.with_index(0) do |line, i|
@window.setpos(13 + i, 2)
@window.addstr(line)
end
draw_border
@window.refresh
end
|