Class: Twterm::Tab::Statuses::Mentions
- Inherits:
-
Object
- Object
- Twterm::Tab::Statuses::Mentions
- Includes:
- Base
- Defined in:
- lib/twterm/tab/statuses/mentions.rb
Instance Attribute Summary
Attributes included from Twterm::Tab::Scrollable
Attributes included from Base
Instance Method Summary collapse
- #close ⇒ Object
- #fetch ⇒ Object
-
#initialize(client) ⇒ Mentions
constructor
A new instance of Mentions.
- #title ⇒ Object
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
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. "Mentioned by @#{status.user.screen_name}: #{status.text}" end fetch { scroller.move_to_top } @auto_reloader = Scheduler.new(300) { fetch } end |
Instance Method Details
#close ⇒ Object
7 8 9 |
# File 'lib/twterm/tab/statuses/mentions.rb', line 7 def close fail NotClosableError end |
#fetch ⇒ Object
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 |
#title ⇒ Object
34 35 36 |
# File 'lib/twterm/tab/statuses/mentions.rb', line 34 def title 'Mentions'.freeze end |