class Basher::UI::CurrentWordView

Attributes

game[RW]

Public Class Methods

lines() click to toggle source
# File lib/basher/ui/current_word_view.rb, line 8
def self.lines
  10
end

Public Instance Methods

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

  remaining = game.word.remaining
  window.attron(Ncurses::A_BOLD)

  if will_overflow?
    puts remaining, h: :center, v: :center
  else
    text = remaining.ascii(font: 'roman')

    text.lines.each do |line|
      puts line, h: :center
    end
  end

  window.attroff(Ncurses::A_BOLD)
end

Private Instance Methods

will_overflow?() click to toggle source
# File lib/basher/ui/current_word_view.rb, line 33
def will_overflow?
  game.word.string.ascii_size(font: 'roman') >= parent.size.columns
end