Class: Twterm::Tab::New::Start

Inherits:
Object
  • Object
show all
Includes:
Base, Scrollable
Defined in:
lib/twterm/tab/new/start.rb

Instance Attribute Summary

Attributes included from Scrollable

#scroller

Attributes included from Base

#window

Instance Method Summary collapse

Methods included from Scrollable

#total_item_count

Methods included from Base

#close, #refresh, #resize

Constructor Details

#initializeStart

Returns a new instance of Start.



25
26
27
28
# File 'lib/twterm/tab/new/start.rb', line 25

def initialize
  super
  refresh
end

Instance Method Details

#==(other) ⇒ Object



8
9
10
# File 'lib/twterm/tab/new/start.rb', line 8

def ==(other)
  other.is_a?(self.class)
end

#drawable_item_countObject



12
13
14
# File 'lib/twterm/tab/new/start.rb', line 12

def drawable_item_count
  (window.maxy - 1).div(2)
end

#itemsObject



16
17
18
19
20
21
22
23
# File 'lib/twterm/tab/new/start.rb', line 16

def items
  %i(
    list_tab
    search_tab
    user_tab
    key_assignments_cheatsheet
  ).freeze
end

#respond_to_key(key) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/twterm/tab/new/start.rb', line 30

def respond_to_key(key)
  return true if scroller.respond_to_key(key)

  case key
  when 10
    perform_selected_action
  when 'L'
    open_list_tab
  when 'S'
    open_search_tab
  when 'U'
    open_user_tab
  else
    return false
  end
  true
end

#titleObject



48
49
50
# File 'lib/twterm/tab/new/start.rb', line 48

def title
  'New tab'.freeze
end