Class: Twterm::Tab::Users::Followers

Inherits:
AbstractUsersTab show all
Includes:
Dumpable
Defined in:
lib/twterm/tab/users/followers.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractUsersTab

#user_ids

Instance Method Summary collapse

Methods included from Dumpable

included

Methods inherited from AbstractUsersTab

#drawable_item_count, #items, #matches?, #respond_to_key

Methods included from Searchable

#matches?, #search_query_window

Methods included from Scrollable

#scroller, #total_item_count

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, #respond_to_key

Methods included from Subscriber

included, #subscribe, #unsubscribe

Constructor Details

#initialize(app, client, user_id) ⇒ Followers

Returns a new instance of Followers.



22
23
24
25
26
27
28
29
30
31
# File 'lib/twterm/tab/users/followers.rb', line 22

def initialize(app, client, user_id)
  super(app, client)

  @user_id = user_id

  fetch.then do
    initially_loaded!
    move_to_top
  end
end

Instance Attribute Details

#user_idObject (readonly)

Returns the value of attribute user_id.



9
10
11
# File 'lib/twterm/tab/users/followers.rb', line 9

def user_id
  @user_id
end

Instance Method Details

#dumpObject



11
12
13
# File 'lib/twterm/tab/users/followers.rb', line 11

def dump
  user_id
end

#fetchObject



15
16
17
18
19
20
# File 'lib/twterm/tab/users/followers.rb', line 15

def fetch
  client.followers(user_id) do |users|
    @user_ids.concat(users.map(&:id)).uniq!
    render
  end
end

#titleObject



33
34
35
# File 'lib/twterm/tab/users/followers.rb', line 33

def title
  user.nil? ? 'Loading...' : "@#{user.screen_name} followers"
end