class Table
Attributes
rows[R]
table[R]
Public Class Methods
new()
click to toggle source
# File lib/table.rb, line 7 def initialize @rows = [] @rows << ['Answer', '????', 'XX', 'XX'] @table = create_table table_style end
Public Instance Methods
create_table()
click to toggle source
# File lib/table.rb, line 36 def create_table Terminal::Table.new headings: %w(Round Guess Color Pos), rows: rows end
show()
click to toggle source
# File lib/table.rb, line 18 def show table end
table_style()
click to toggle source
# File lib/table.rb, line 14 def table_style table.style = { width: 40, padding_left: 3, border_x: '=', border_i: 'X' } end
update(guess_number, guess, number_correct, position, answer)
click to toggle source
# File lib/table.rb, line 26 def update(guess_number, guess, number_correct, position, answer) if guess_number < 10 @rows << [guess_number, guess, number_correct, position] else hidden_answer(answer) end @table = create_table table_style end