Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
wesley974 committed Mar 14, 2017
1 parent 0f27dda commit 7c6592c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
module Format
SPACES = 50
HEADER = %w(Name Attempts Time!).freeze
TITLE = 'The best 3 SCORE'
def self.text(title: nil, msg: nil)
puts "\n\n#{title.center(SPACES).green.bold}" if title
puts "#{msg.center(SPACES)}\n" if msg
end

def self.table(datas)
table = Terminal::Table.new headings: HEADER, rows: datas
table = Terminal::Table.new title: TITLE, headings: HEADER, rows: datas
table.align_column(1, :center)
table.align_column(2, :center)
table.title = 'The best 3 SCORE'
puts table.render.split("\n").map { |ln| ln.center(SPACES) }.join("\n")
end
end

0 comments on commit 7c6592c

Please sign in to comment.