Module: Pry::SendTweet::UserRenderer

Included in:
BaseCommand
Defined in:
lib/pry/send_tweet/renderers/user_renderer.rb

Instance Method Summary collapse

Instance Method Details

#render_user(user) ⇒ Object



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 <<-USER.each_line.map(&:strip).join("\n")
#{bold("Tweets")}    #{user.tweets_count}
#{bold("Followers")} #{user.followers_count}
#{bold("Following")} #{user.friends_count}
#{user.description}
USER
  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