Class: Twterm::Tab::TimelineTab

Inherits:
Object
  • Object
show all
Includes:
StatusesTab
Defined in:
lib/twterm/tab/timeline_tab.rb

Instance Attribute Summary

Attributes included from Base

#title

Instance Method Summary collapse

Methods included from StatusesTab

#append, #delete_status, #favorite, #open_link, #prepend, #reply, #respond_to_key, #retweet, #show_conversation, #show_user, #update

Methods included from AutoReloadable

#auto_reload

Methods included from Scrollable

#count, #draw_scroll_bar, #index, #item_appended, #item_prepended, #last, #move_down, #move_to_bottom, #move_to_top, #move_up, #offset, #offset_from_bottom, #respond_to_key, #update_scrollbar_length

Methods included from Base

#==, #refresh, #respond_to_key

Constructor Details

#initialize(client) ⇒ TimelineTab

Returns a new instance of TimelineTab.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/twterm/tab/timeline_tab.rb', line 6

def initialize(client)
  fail ArgumentError, 'argument must be an instance of Client class' unless client.is_a? Client

  super()
  @client = client
  @client.on_timeline_status(&method(:prepend))
  @title = 'Timeline'

  fetch { move_to_top }
  auto_reload(180) { fetch }
end

Instance Method Details

#closeObject



28
29
30
# File 'lib/twterm/tab/timeline_tab.rb', line 28

def close
  fail NotClosableError
end

#fetchObject



18
19
20
21
22
23
24
25
26
# File 'lib/twterm/tab/timeline_tab.rb', line 18

def fetch
  Thread.new do
    @client.home_timeline do |statuses|
      statuses.each(&method(:prepend))
      sort
      yield if block_given?
    end
  end
end