class Basher::UI::TitleView

Attributes

state[RW]

Public Class Methods

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

Public Instance Methods

setup() click to toggle source
# File lib/basher/ui/title_view.rb, line 20
def setup
  if will_overflow?
    puts text, h: :center, v: :center
  else
    text.ascii(font: 'broadway').lines.each do |line|
      puts line, h: :center
    end
  end
end
text() click to toggle source
# File lib/basher/ui/title_view.rb, line 12
def text
  case state.current
  when :menu   then 'Basher!'
  when :paused then 'Paused'
  else ''
  end
end

Private Instance Methods

will_overflow?() click to toggle source
# File lib/basher/ui/title_view.rb, line 32
def will_overflow?
  text.ascii_size(font: 'broadway') >= parent.columns
end