2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/pry/send_tweet/renderers/user_renderer.rb', line 2
def render_user(user)
title = "@#{user.screen_name} ( https://twitter.com/#{user.screen_name} )"
body = CGI.unescapeHTML "\#{bold(\"Tweets\")} \#{user.tweets_count}\n\#{bold(\"Followers\")} \#{user.followers_count}\n\#{bold(\"Following\")} \#{user.friends_count}\n\#{user.description}\n".each_line.map(&:strip).join("\n")
height = body.lines.count > box_height ? body.lines.count : box_height
TTY::Box.frame(
height: height,
width: box_width,
title: {top_left: title}
) { body }.to_s
end
|