Class: Twterm::Tab::New::Index

Inherits:
AbstractTab show all
Includes:
Scrollable
Defined in:
lib/twterm/tab/new/index.rb

Instance Attribute Summary

Attributes inherited from AbstractTab

#window

Instance Method Summary collapse

Methods included from Scrollable

#scroller, #total_item_count

Methods inherited from AbstractTab

#close, #find_or_fetch_list, #find_or_fetch_status, #find_or_fetch_user, #render

Methods included from Subscriber

included, #subscribe, #unsubscribe

Constructor Details

#initialize(app, client) ⇒ Index

Returns a new instance of Index.



32
33
34
35
# File 'lib/twterm/tab/new/index.rb', line 32

def initialize(app, client)
  super(app, client)
  render
end

Instance Method Details

#==(other) ⇒ Object



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

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

#drawable_item_countObject



16
17
18
# File 'lib/twterm/tab/new/index.rb', line 16

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

#itemsObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/twterm/tab/new/index.rb', line 20

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

#respond_to_key(key) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/twterm/tab/new/index.rb', line 37

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

  case key
  when 10
    perform_selected_action
  else
    return false
  end
  true
end

#titleObject



49
50
51
# File 'lib/twterm/tab/new/index.rb', line 49

def title
  'New tab'.freeze
end