Class: Ayadn::Search
Instance Method Summary collapse
- #find(words, options) ⇒ Object
- #hashtag(hashtag, options) ⇒ Object
-
#initialize(api, view, workers) ⇒ Search
constructor
A new instance of Search.
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
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ayadn/search.rb', line 29 def find(words, ) Settings..timeline.compact = true if [:compact] Settings.global.force = true if [:force] @view.downloading() stream = get_stream(words, ) if [:users] stream_object = stream["data"].map { |user| UserObject.new(user) } elsif ![:channels] stream_object = StreamObject.new(stream) end if [:users] get_users(stream_object, ) elsif [:channels] get_channels(stream, ) else get_generic(stream_object, words, ) end if Settings..timeline.compact && ![:raw] puts "\n" end end |
#hashtag(hashtag, options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ayadn/search.rb', line 12 def hashtag(hashtag, ) Settings..timeline.compact = true if [:compact] Settings.global.force = true if [:force] @view.downloading() stream = @api.get_hashtag(hashtag) stream_object = StreamObject.new(stream) Check.new.no_data(stream_object, 'hashtag') if [:extract] @view.all_hashtag_links(stream_object, hashtag) else @view.render(stream_object, ) if Settings..timeline.compact && ![:raw] puts "\n" end end end |