Class: Twterm::Tab::New::List
Constant Summary
collapse
- @@lists =
nil
Instance Attribute Summary
Attributes inherited from AbstractTab
#window
Instance Method Summary
collapse
Methods included from Scrollable
#scroller
Methods included from Publisher
#publish
Methods included from Utils
check_type
Methods included from Loadable
#initially_loaded!, #initially_loaded?
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) ⇒ List
Returns a new instance of List.
23
24
25
26
27
28
29
30
|
# File 'lib/twterm/tab/new/list.rb', line 23
def initialize(app, client)
super(app, client)
client.lists.then do |lists|
@@lists = lists.sort_by(&:full_name)
initially_loaded!
end
end
|
Instance Method Details
#==(other) ⇒ Object
15
16
17
|
# File 'lib/twterm/tab/new/list.rb', line 15
def ==(other)
other.is_a?(self.class)
end
|
#drawable_item_count ⇒ Object
19
20
21
|
# File 'lib/twterm/tab/new/list.rb', line 19
def drawable_item_count
(window.maxy - 6).div(3)
end
|
#items ⇒ Object
32
33
34
|
# File 'lib/twterm/tab/new/list.rb', line 32
def items
@@lists || []
end
|
#matches?(list, query) ⇒ Boolean
36
37
38
39
40
41
|
# File 'lib/twterm/tab/new/list.rb', line 36
def matches?(list, query)
[
list.description,
list.full_name,
].any? { |x| x.downcase.include?(query.downcase) }
end
|
#respond_to_key(key) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/twterm/tab/new/list.rb', line 43
def respond_to_key(key)
return true if scroller.respond_to_key(key)
case key
when 10
return true if current_list.nil?
list_tab = Tab::Statuses::ListTimeline.new(app, client, current_list.id)
app.tab_manager.switch(list_tab)
else
return false
end
true
end
|
#title ⇒ Object
58
59
60
|
# File 'lib/twterm/tab/new/list.rb', line 58
def title
'New tab'.freeze
end
|
#total_item_count ⇒ Object
62
63
64
|
# File 'lib/twterm/tab/new/list.rb', line 62
def total_item_count
items.count
end
|