86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/inspec/ui.rb', line 86
def headline(str, opts = { print: true })
str = str.dup.to_s
if str.length < 76
dash_length = 80 - str.length - 4 dash_length /= 2
else
dash_length = 0
end
result = "\n"
result += " " + (color? ? GLYPHS[:em_dash] : "-") * dash_length + " "
result += color? ? ANSI_CODES[:bold] + ANSI_CODES[:color][:white] : ""
result += str
result += color? ? ANSI_CODES[:reset] : ""
result += " " + (color? ? GLYPHS[:em_dash] : "-") * dash_length + " "
result += "\n\n"
print_or_return(result, opts[:print])
end
|