Class: Cucumber::Term::Banner::BannerMaker

Inherits:
Object
  • Object
show all
Includes:
ANSIColor
Defined in:
lib/cucumber/term/banner.rb

Constant Summary

Constants included from ANSIColor

ANSIColor::ATTRIBUTES, ANSIColor::ATTRIBUTE_NAMES, ANSIColor::COLORED_REGEXP

Instance Method Summary collapse

Methods included from ANSIColor

#attributes, included, #uncolored

Instance Method Details

#display_banner(lines, io, border_modifiers) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cucumber/term/banner.rb', line 15

def display_banner(lines, io, border_modifiers)
  lines = lines.split("\n") if lines.is_a? String
  longest_line_length = lines.map { |line| line_length(line) }.max

  io.puts apply_modifiers("#{'' * (longest_line_length + 2)}", border_modifiers)
  lines.map do |line|
    padding = ' ' * (longest_line_length - line_length(line))
    io.puts "#{apply_modifiers('', border_modifiers)} #{display_line(line)}#{padding} #{apply_modifiers('', border_modifiers)}"
  end
  io.puts apply_modifiers("#{'' * (longest_line_length + 2)}", border_modifiers)
end