Class: Twterm::Tab::Statuses::UserTimeline

Inherits:
Base
  • Object
show all
Includes:
Dumpable
Defined in:
lib/twterm/tab/statuses/user_timeline.rb

Instance Attribute Summary collapse

Attributes included from Twterm::Tab::Scrollable

#scroller

Attributes inherited from Base

#window

Instance Method Summary collapse

Methods included from Dumpable

included

Methods inherited from Base

#append, #delete, #destroy_status, #drawable_item_count, #favorite, #items, #matches?, #open_link, #prepend, #reply, #respond_to_key, #retweet, #show_conversation, #show_user, #statuses, #total_item_count

Methods included from Utils

check_type

Methods included from Loadable

#initially_loaded!, #initially_loaded?

Methods included from Subscriber

included, #subscribe, #unsubscribe

Methods included from Twterm::Tab::Searchable

#matches?

Methods included from Twterm::Tab::Scrollable

#total_item_count

Methods included from Publisher

#publish

Methods inherited from Base

#find_or_fetch_list, #find_or_fetch_status, #find_or_fetch_user, #render, #respond_to_key

Constructor Details

#initialize(app, client, user_id) ⇒ UserTimeline

Returns a new instance of UserTimeline.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 28

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

  @user_id = user_id

  find_or_fetch_user(user_id).then do |user|
    @user = user
    app.tab_manager.refresh_window

    reload.then do
      initially_loaded!
      scroller.move_to_top
    end

    @auto_reloader = Scheduler.new(120) { reload }
  end
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



9
10
11
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 9

def user
  @user
end

#user_idObject (readonly)

Returns the value of attribute user_id.



9
10
11
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 9

def user_id
  @user_id
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 11

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

#closeObject



15
16
17
18
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 15

def close
  @auto_reloader.kill if @auto_reloader
  super
end

#dumpObject



20
21
22
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 20

def dump
  @user.id
end

#fetchObject



24
25
26
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 24

def fetch
  client.user_timeline(@user.id)
end

#titleObject



46
47
48
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 46

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