Class: Ayadn::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/ayadn/search.rb

Instance Method Summary collapse

Constructor Details

#initialize(api, view, workers) ⇒ Search

Returns a new instance of Search.



6
7
8
9
10
# File 'lib/ayadn/search.rb', line 6

def initialize api, view, workers
  @api = api
  @view = view
  @workers = workers
end

Instance Method Details

#find(words, options) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ayadn/search.rb', line 24

def find(words, options)
  Settings.options[:force] = true if options[:force]
  @view.downloading(options)
  stream = get_stream(words, options)
  Check.no_data(stream, 'search')
  if options[:users]
    get_users(stream, options)
  elsif options[:channels]
    get_channels(stream, options)
  else
    get_generic(stream, words, options)
  end
end

#hashtag(hashtag, options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ayadn/search.rb', line 12

def hashtag(hashtag, options)
  Settings.options[:force] = true if options[:force]
  @view.downloading(options)
  stream = @api.get_hashtag(hashtag)
  Check.no_data(stream, 'hashtag')
  if options[:extract]
    @view.all_hashtag_links(stream, hashtag)
  else
    @view.render(stream, options)
  end
end