Class: Twterm::Tab::Statuses::Conversation
- Inherits:
-
Object
- Object
- Twterm::Tab::Statuses::Conversation
- Defined in:
- lib/twterm/tab/statuses/conversation.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Attributes included from Twterm::Tab::Scrollable
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) ⇒ Conversation
constructor
A new instance of Conversation.
- #title ⇒ Object
Methods included from Dumpable
Methods included from Base
#append, #delete, #destroy_status, #drawable_item_count, #favorite, #fetch, #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
#close, #refresh, #resize, #respond_to_key
Constructor Details
#initialize(status_id) ⇒ Conversation
Returns a new instance of Conversation.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 35 def initialize(status_id) super() Status.find_or_fetch(status_id).then do |status| @status = status append(status) scroller.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.
8 9 10 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 8 def status @status end |
Instance Method Details
#==(other) ⇒ Object
10 11 12 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 10 def ==(other) other.is_a?(self.class) && status == other.status end |
#dump ⇒ Object
31 32 33 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 31 def dump @status.id end |
#fetch_in_reply_to_status(status) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 14 def fetch_in_reply_to_status(status) status.in_reply_to_status.then 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
23 24 25 26 27 28 29 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 23 def fetch_replies(status) status.replies.each do |reply| prepend(reply) sort Thread.new { fetch_replies(reply) } end end |
#title ⇒ Object
48 49 50 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 48 def title 'Conversation'.freeze end |