Class: Alfi::Providers::Offline

Inherits:
Base
  • Object
show all
Defined in:
lib/alfi/providers/offline.rb

Overview

require ‘alfi/providers/base’

Instance Method Summary collapse

Methods inherited from Base

#add_repo_to_list, #add_suggestions, #add_to_list, #query_url

Constructor Details

#initialize(query, search_type) ⇒ Offline

Returns a new instance of Offline.



3
4
5
# File 'lib/alfi/providers/offline.rb', line 3

def initialize(query, search_type)
  @query = query
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/alfi/providers/offline.rb', line 7

def call
  google_libs = [
    'com.android.support:appcompat-v7',
    'com.android.support:cardview-v7',
    'com.android.support:gridlayout-v7',
    'com.android.support:leanback-v17',
    'com.android.support:mediarouter-v7',
    'com.android.support:palette-v7',
    'com.android.support:support-annotations',
    'com.android.support:support-v4',
    'com.android.support:support-v13',
    'com.google.android.gms:play-services-wearable',
    'com.google.android.gms:play-services',
    'com.android.support:recyclerview-v7'
  ]
  results = google_libs.map { |lib| "#{lib}:+" if lib.include?(@query) }.compact
  return unless results.size > 0
  add_to_list '  # Google'
  results.each { |library| add_repo_to_list(library) }
end