Class: Twterm::Tab::Statuses::UserTimeline
- Includes:
- Dumpable
- Defined in:
- lib/twterm/tab/statuses/user_timeline.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Attributes included from Twterm::Tab::Scrollable
Attributes inherited from Base
Instance Method Summary collapse
- #==(other) ⇒ Object
- #close ⇒ Object
- #dump ⇒ Object
- #fetch ⇒ Object
-
#initialize(user_id) ⇒ UserTimeline
constructor
A new instance of UserTimeline.
- #title ⇒ Object
Methods included from Dumpable
Methods inherited from Base
#append, #delete, #destroy_status, #drawable_item_count, #favorite, #items, #open_link, #prepend, #reply, #respond_to_key, #retweet, #show_conversation, #show_user, #statuses, #total_item_count, #touch_statuses, #update
Methods included from Utils
Methods included from Subscriber
included, #subscribe, #unsubscribe
Methods included from Twterm::Tab::Scrollable
Methods included from Publisher
Methods included from FilterableList
#filter, #filter_query, #items, #reset_filter
Methods inherited from Base
Constructor Details
#initialize(user_id) ⇒ UserTimeline
Returns a new instance of UserTimeline.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 32 def initialize(user_id) super() @user_id = user_id User.find_or_fetch(user_id).then do |user| @user = user TabManager.instance.refresh_window fetch { scroller.move_to_top } @auto_reloader = Scheduler.new(120) { fetch } end end |
Instance Attribute Details
#user ⇒ Object (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_id ⇒ Object (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 |
#close ⇒ Object
15 16 17 18 |
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 15 def close @auto_reloader.kill if @auto_reloader super end |
#dump ⇒ Object
20 21 22 |
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 20 def dump @user.id end |
#fetch ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 24 def fetch Client.current.user_timeline(@user.id).then do |statuses| statuses.reverse.each(&method(:prepend)) sort yield if block_given? end end |
#title ⇒ Object
46 47 48 |
# File 'lib/twterm/tab/statuses/user_timeline.rb', line 46 def title @user.nil? ? 'Loading...' : "@#{@user.screen_name} timeline" end |