Module: Fargo::Supports::Searches

Extended by:
ActiveSupport::Concern
Included in:
Client
Defined in:
lib/fargo/supports/searches.rb

Instance Method Summary collapse

Instance Method Details

#remove_search(search) ⇒ Object



49
50
51
52
53
# File 'lib/fargo/supports/searches.rb', line 49

def remove_search search
  search = normalize search
  @searches.delete search.to_s
  @search_objects.delete search.to_s
end

#search(search) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/fargo/supports/searches.rb', line 31

def search search
  raise ConnectionException.new 'Not connected yet!' unless connected?

  search                       = normalize search
  @searches[search.to_s]       = []
  @search_objects[search.to_s] = search
  search_hub search
end

#search_files(options) ⇒ Object

see parser#@@search for what’s passed in

searches this client’s files based on those options and returns an array of SearchResult(s)



14
15
16
17
# File 'lib/fargo/supports/searches.rb', line 14

def search_files options
  # TODO: implement me
  []
end

#search_hub(query) ⇒ Object

Raises:

  • (ConnectionError)


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fargo/supports/searches.rb', line 19

def search_hub query
  raise ConnectionError.new('Not connected Yet!') unless connected?

  if config.passive
    location = "Hub:#{config.nick}"
  else
    location = "#{config.address}:#{config.search_port}"
  end

  hub.send_message 'Search', "#{location} #{query.to_s}"
end

#search_results(search) ⇒ Object



44
45
46
47
# File 'lib/fargo/supports/searches.rb', line 44

def search_results search
  search = normalize search
  @searches[search.to_s]
end

#searchesObject



40
41
42
# File 'lib/fargo/supports/searches.rb', line 40

def searches
  @searches.keys.map { |k| @search_objects[k] }
end