Method: Howzit::StringUtils#format_header
- Defined in:
- lib/howzit/stringutils.rb
#format_header(opts = {}) ⇒ String
Make a fancy title line for the topic
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/howzit/stringutils.rb', line 351 def format_header(opts = {}) title = dup = { hr: "\u{254C}", color: '{bg}', border: '{x}', mark: should_mark_iterm? } .merge!(opts) case Howzit.[:header_format] when :block Color.template("#{[:color]}\u{258C}#{title}#{should_mark_iterm? && [:mark] ? iterm_marker : ''}{x}") else cols = TTY::Screen.columns cols = Howzit.[:wrap] if (Howzit.[:wrap]).positive? && cols > Howzit.[:wrap] title = Color.template("#{[:border]}#{[:hr] * 2}( #{[:color]}#{title}#{[:border]} )") tail = if should_mark_iterm? "#{[:hr] * (cols - title.uncolor.length - 15)}#{[:mark] ? iterm_marker : ''}" else [:hr] * (cols - title.uncolor.length) end Color.template("#{title}#{tail}{x}") end end |