Class: Twterm::Tab::ConversationTab

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

Instance Attribute Summary collapse

Attributes included from Base

#title

Instance Method Summary collapse

Methods included from StatusesTab

#append, #delete_status, #favorite, #fetch, #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

#close, #refresh, #respond_to_key

Constructor Details

#initialize(status) ⇒ ConversationTab

Returns a new instance of ConversationTab.



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

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

  @title = 'Conversation'

  super()
  prepend(status)
  Thread.new { fetch_reply(status) }
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/twterm/tab/conversation_tab.rb', line 6

def status
  @status
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/twterm/tab/conversation_tab.rb', line 26

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

#fetch_reply(status) ⇒ Object



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

def fetch_reply(status)
  status.in_reply_to_status do |reply|
    return if reply.nil?
    append(reply)
    fetch_reply(reply)
  end
end