Class: Twterm::Tab::SearchTab

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

Instance Attribute Summary collapse

Attributes included from Base

#title

Instance Method Summary collapse

Methods included from StatusesTab

#append, #delete_status, #favorite, #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(query) ⇒ SearchTab

Returns a new instance of SearchTab.



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

def initialize(query)
  super()

  @query = query
  @title = "\"#{@query}\""

  fetch { move_to_top }
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



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

def query
  @query
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
# File 'lib/twterm/tab/search_tab.rb', line 24

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

#fetchObject



17
18
19
20
21
22
# File 'lib/twterm/tab/search_tab.rb', line 17

def fetch
  Client.current.search(@query) do |statuses|
    statuses.reverse.each { |status| prepend(status) }
    yield if block_given?
  end
end