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

Inherits:
Object
  • Object
show all
Includes:
ANSIColor
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/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



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/term/banner.rb', line 13

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