Class: Twterm::Tab::Statuses::Conversation
- Includes:
- Dumpable
- 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 inherited 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 inherited 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 Utils
Methods included from Subscriber
included, #subscribe, #unsubscribe
Methods included from Twterm::Tab::Scrollable
Methods included from Publisher
Methods included from FilterableList
#filter, #filter_query, #items, #reset_filter
Methods inherited from Base
#close, #refresh, #respond_to_key
Constructor Details
#initialize(status_id) ⇒ Conversation
Returns a new instance of Conversation.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 36 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.
9 10 11 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 9 def status @status end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 11 def ==(other) other.is_a?(self.class) && status == other.status end |
#dump ⇒ Object
32 33 34 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 32 def dump @status.id end |
#fetch_in_reply_to_status(status) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 15 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
24 25 26 27 28 29 30 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 24 def fetch_replies(status) status.replies.each do |reply| prepend(reply) sort Thread.new { fetch_replies(reply) } end end |
#title ⇒ Object
49 50 51 |
# File 'lib/twterm/tab/statuses/conversation.rb', line 49 def title 'Conversation'.freeze end |