Class: Basher::UI::MenuView

Inherits:
BaseView
  • Object
show all
Defined in:
lib/basher/ui/menu_view.rb

Instance Attribute Summary collapse

Attributes inherited from BaseView

#should_redraw

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseView

#clear, #initialize, #resize_and_reposition, #will_resize!

Constructor Details

This class inherits a constructor from Basher::UI::BaseView

Instance Attribute Details

#stateObject

Returns the value of attribute state.



5
6
7
# File 'lib/basher/ui/menu_view.rb', line 5

def state
  @state
end

Class Method Details

.linesObject



7
8
9
# File 'lib/basher/ui/menu_view.rb', line 7

def self.lines
  1
end

Instance Method Details

#itemsObject



11
12
13
14
15
16
17
18
19
# File 'lib/basher/ui/menu_view.rb', line 11

def items
  items = case state.current
    when :menu    then %w([S]-Start [Q]-Quit)
    when :paused  then %w([ESC]-Resume [Q]-Menu)
    else []
    end
  items << "v #{Basher::VERSION}"
  items.join(' | ')
end

#setupObject



21
22
23
# File 'lib/basher/ui/menu_view.rb', line 21

def setup
  puts items, h: :center
end