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.



30
31
32
33
# File 'lib/twterm/tab/new/index.rb', line 30

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

Instance Method Details

#==(other) ⇒ Object



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

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

#drawable_item_countObject



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

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

#itemsObject



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

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

#respond_to_key(key) ⇒ Object



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

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



47
48
49
# File 'lib/twterm/tab/new/index.rb', line 47

def title
  'New tab'.freeze
end