Class: Twterm::Tab::Statuses::Home

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

Instance Attribute Summary

Attributes included from Twterm::Tab::Scrollable

#scroller

Attributes included from Base

#window

Instance Method Summary collapse

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(client) ⇒ Home

Returns a new instance of Home.



19
20
21
22
23
24
25
26
27
28
# File 'lib/twterm/tab/statuses/home.rb', line 19

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))

  fetch { scroller.move_to_top }
  @auto_reloader = Scheduler.new(180) { fetch }
end

Instance Method Details

#closeObject



7
8
9
# File 'lib/twterm/tab/statuses/home.rb', line 7

def close
  fail NotClosableError
end

#fetchObject



11
12
13
14
15
16
17
# File 'lib/twterm/tab/statuses/home.rb', line 11

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

#titleObject



30
31
32
# File 'lib/twterm/tab/statuses/home.rb', line 30

def title
  'Home'.freeze
end