Class: USaidWat::CLI::CompactPostFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- USaidWat::CLI::CompactPostFormatter
- Defined in:
- lib/usaidwat/formatter/post.rb
Instance Method Summary collapse
Methods inherited from BaseFormatter
#initialize, #pattern, #pattern?, #raw?, #relative_dates?
Methods included from TTYFormatter
Constructor Details
This class inherits a constructor from USaidWat::CLI::BaseFormatter
Instance Method Details
#format(post) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/usaidwat/formatter/post.rb', line 30 def format(post) cols = tty.width out = StringIO.new subreddit = post.subreddit cols -= subreddit.length + 1 title = post.title.strip.unescape_html out.write(subreddit.color(:green)) out.write(" #{title}\n") out.rewind out.read end |