Class: Twterm::Tab::Statuses::Mentions

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/twterm/tab/statuses/mentions.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) ⇒ Mentions

Returns a new instance of Mentions.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/twterm/tab/statuses/mentions.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_mention do |status|
    prepend(status)
    Notifier.instance.show_message "Mentioned by @#{status.user.screen_name}: #{status.text}"
  end

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

Instance Method Details

#closeObject



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

def close
  fail NotClosableError
end

#fetchObject



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

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

#titleObject



34
35
36
# File 'lib/twterm/tab/statuses/mentions.rb', line 34

def title
  'Mentions'.freeze
end