class Basher::UI::RemainingWordsView

Attributes

game[RW]

Public Class Methods

lines() click to toggle source
# File lib/basher/ui/remaining_words_view.rb, line 6
def self.lines
  1
end

Public Instance Methods

setup() click to toggle source
# File lib/basher/ui/remaining_words_view.rb, line 10
def setup
  clear

  if will_overflow?
    trimmed = remaining_words.join(' ')[0..(parent.columns - 1)]
    words   = trimmed[0..(trimmed.rindex(' ') - 1)]
  else
    words   = remaining_words.join(' ')
  end

  puts words, h: :center
end

Private Instance Methods

remaining_words() click to toggle source
# File lib/basher/ui/remaining_words_view.rb, line 25
def remaining_words
  game.level.remaining[1..-1]
end
will_overflow?() click to toggle source
# File lib/basher/ui/remaining_words_view.rb, line 29
def will_overflow?
  remaining_words.join(' ').size > columns
end