lib/cli/ui/frame.rb in cli-ui-1.1.1 vs lib/cli/ui/frame.rb in cli-ui-1.1.2
- old
+ new
@@ -173,11 +173,11 @@
# ==== Options
#
# * +:color+ - The color of the prefix. Defaults to +Thread.current[:cliui_frame_color_override]+ or nil
#
def prefix(color: nil)
- pfx = String.new
+ pfx = +''
items = FrameStack.items
items[0..-2].each do |item|
pfx << CLI::UI.resolve_color(item).code << CLI::UI::Box::Heavy::VERT
end
if item = items.last
@@ -213,11 +213,11 @@
def edge(text, color: raise, first: raise, right_text: nil)
color = CLI::UI.resolve_color(color)
text = CLI::UI.resolve_text("{{#{color.name}:#{text}}}")
- prefix = String.new
+ prefix = +''
FrameStack.items.each do |item|
prefix << CLI::UI.resolve_color(item).code << CLI::UI::Box::Heavy::VERT
end
prefix << color.code << first << (CLI::UI::Box::Heavy::HORZ * 2)
text ||= ''
@@ -225,11 +225,11 @@
prefix << ' ' << text << ' '
end
termwidth = CLI::UI::Terminal.width
- suffix = String.new
+ suffix = +''
if right_text
suffix << ' ' << right_text << ' '
end
suffix_width = CLI::UI::ANSI.printing_width(suffix)
@@ -245,10 +245,10 @@
# if prefix_end > termwidth
# we *could* truncate it, but let's just let it overflow to the
# next line and call it poor usage of this API.
end
- o = String.new
+ o = +''
is_ci = ![0, '', nil].include?(ENV['CI'])
# Jumping around the line can cause some unwanted flashes
o << CLI::UI::ANSI.hide_cursor