Class: Twterm::Tab::Statuses::ListTimeline

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

Instance Attribute Summary collapse

Attributes included from Twterm::Tab::Scrollable

#scroller

Attributes included from Base

#title, #window

Instance Method Summary collapse

Methods included from Dumpable

included

Methods included 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 Twterm::Tab::Scrollable

#total_item_count

Methods included from FilterableList

#filter, #filter_query, #items, #reset_filter

Methods included from Base

#refresh, #resize, #respond_to_key

Constructor Details

#initialize(list_id) ⇒ ListTimeline

Returns a new instance of ListTimeline.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/twterm/tab/statuses/list_timeline.rb', line 10

def initialize(list_id)
  super()

  self.title = 'Loading...'.freeze

  List.find_or_fetch(list_id).then do |list|
    @list = list
    self.title = @list.full_name
    TabManager.instance.refresh_window
    fetch { scroller.move_to_top }
    @auto_reloader = Scheduler.new(300) { fetch }
  end
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



8
9
10
# File 'lib/twterm/tab/statuses/list_timeline.rb', line 8

def list
  @list
end

Instance Method Details

#==(other) ⇒ Object



37
38
39
# File 'lib/twterm/tab/statuses/list_timeline.rb', line 37

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

#closeObject



32
33
34
35
# File 'lib/twterm/tab/statuses/list_timeline.rb', line 32

def close
  @auto_reloader.kill if @auto_reloader
  super
end

#dumpObject



41
42
43
# File 'lib/twterm/tab/statuses/list_timeline.rb', line 41

def dump
  @list.id
end

#fetchObject



24
25
26
27
28
29
30
# File 'lib/twterm/tab/statuses/list_timeline.rb', line 24

def fetch
  Client.current.list_timeline(@list).then do |statuses|
    statuses.reverse.each(&method(:prepend))
    sort
    yield if block_given?
  end
end