Class: Twterm::Tab::ConversationTab
- Inherits:
-
Object
- Object
- Twterm::Tab::ConversationTab
- Includes:
- Dumpable, StatusesTab
- Defined in:
- lib/twterm/tab/conversation_tab.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Attributes included from Base
Instance Method Summary collapse
- #==(other) ⇒ Object
- #dump ⇒ Object
- #fetch_in_reply_to_status(status) ⇒ Object
- #fetch_replies(status) ⇒ Object
-
#initialize(status_id) ⇒ ConversationTab
constructor
A new instance of ConversationTab.
Methods included from Dumpable
Methods included from StatusesTab
#append, #delete, #destroy_status, #favorite, #fetch, #open_link, #prepend, #reply, #respond_to_key, #retweet, #show_conversation, #show_user, #statuses, #touch_statuses, #update
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_id) ⇒ ConversationTab
Returns a new instance of ConversationTab.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/twterm/tab/conversation_tab.rb', line 9 def initialize(status_id) @title = 'Conversation' super() Status.find_or_fetch(status_id) do |status| @status = status append(status) move_to_top Thread.new { fetch_in_reply_to_status(status) } Thread.new { fetch_replies(status) } end end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/twterm/tab/conversation_tab.rb', line 7 def status @status end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/twterm/tab/conversation_tab.rb', line 40 def ==(other) other.is_a?(self.class) && status == other.status end |
#dump ⇒ Object
44 45 46 |
# File 'lib/twterm/tab/conversation_tab.rb', line 44 def dump @status.id end |
#fetch_in_reply_to_status(status) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/twterm/tab/conversation_tab.rb', line 23 def fetch_in_reply_to_status(status) status.in_reply_to_status do |in_reply_to| return if in_reply_to.nil? append(in_reply_to) sort Thread.new { fetch_in_reply_to_status(in_reply_to) } end end |
#fetch_replies(status) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/twterm/tab/conversation_tab.rb', line 32 def fetch_replies(status) status.replies.each do |reply| prepend(reply) sort Thread.new { fetch_replies(reply) } end end |