Archived
1
0
Fork 0

Use String#ljustetc again

This commit is contained in:
Braiden Vasco 2017-07-27 23:23:48 +00:00
parent 9fa94e5f0f
commit 2f07a142e8

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
module Widgets module Widgets
using Helpers
class Menu < Base class Menu < Base
def trigger(event) def trigger(event)
case event case event
@ -48,11 +50,7 @@ module Widgets
end, end,
window, window,
) do ) do
if friend[:name].length <= props[:width] - 2 addstr friend[:name].ljustetc props[:width] - 2
addstr friend[:name].ljust props[:width] - 2
else
addstr "#{friend[:name][0...props[:width] - 5]}..."
end
end end
end end
end end