Class: Twterm::Tab::UserListManagement
Constant Summary
collapse
- @@lists =
Concurrent::Array.new
Instance Attribute Summary
Attributes inherited from AbstractTab
#window
Instance Method Summary
collapse
Methods included from Scrollable
#scroller, #total_item_count
Methods included from Publisher
#publish
Methods included from Utils
check_type
Methods included from Loadable
#initially_loaded!, #initially_loaded?
Methods included from Dumpable
included
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
Returns a new instance of UserListManagement.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/twterm/tab/user_list_management.rb', line 20
def initialize(app, client, user_id)
super(app, client)
@user_id = user_id
@list_ids = Concurrent::Array.new
client.owned_lists.then do |lists|
@@lists = lists.sort_by(&:full_name)
render
end
client.memberships(user_id, filter_to_owned_lists: true, count: 1000).then do |lists|
@list_ids = lists.map(&:id)
initially_loaded!
end
end
|
Instance Method Details
#drawable_item_count ⇒ Object
37
38
39
|
# File 'lib/twterm/tab/user_list_management.rb', line 37
def drawable_item_count
window.maxy / 3
end
|
#dump ⇒ Object
41
42
43
|
# File 'lib/twterm/tab/user_list_management.rb', line 41
def dump
user_id
end
|
#items ⇒ Object
61
62
63
|
# File 'lib/twterm/tab/user_list_management.rb', line 61
def items
@@lists
end
|
#matches?(list, query) ⇒ Boolean
65
66
67
68
69
70
|
# File 'lib/twterm/tab/user_list_management.rb', line 65
def matches?(list, query)
[
list.description,
list.full_name,
].any? { |x| x.downcase.include?(query.downcase) }
end
|
#respond_to_key(key) ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/twterm/tab/user_list_management.rb', line 72
def respond_to_key(key)
return true if scroller.respond_to_key(key)
case key
when 10 then toggle
end
end
|
#title ⇒ Object
80
81
82
|
# File 'lib/twterm/tab/user_list_management.rb', line 80
def title
(user.nil? ? 'Loading' : "@#{user.screen_name} lists").freeze
end
|