Class: Alfi::Providers::Base
- Inherits:
-
Object
- Object
- Alfi::Providers::Base
- Defined in:
- lib/alfi/providers/base.rb
Instance Method Summary collapse
- #add_repo_to_list(package) ⇒ Object
- #add_suggestions(suggestions) ⇒ Object
- #add_to_list(helper_string) ⇒ Object
- #call ⇒ Object
-
#initialize(query, search_type) ⇒ Base
constructor
A new instance of Base.
- #query_url ⇒ Object
Constructor Details
#initialize(query, search_type) ⇒ Base
Returns a new instance of Base.
2 3 4 5 6 7 8 9 |
# File 'lib/alfi/providers/base.rb', line 2 def initialize(query, search_type) @query = query @uri = URI.parse(query_url(query)) @http = Net::HTTP.new(@uri.host, @uri.port) @request = Net::HTTP::Get.new(@uri.request_uri) @search_type = search_type request_extensions if self.class.method_defined?(:request_extensions) end |
Instance Method Details
#add_repo_to_list(package) ⇒ Object
27 28 29 |
# File 'lib/alfi/providers/base.rb', line 27 def add_repo_to_list(package) $result_list << " implementation(\"#{package}\")".green end |
#add_suggestions(suggestions) ⇒ Object
23 24 25 |
# File 'lib/alfi/providers/base.rb', line 23 def add_suggestions(suggestions) $suggestions += Array(suggestions) end |
#add_to_list(helper_string) ⇒ Object
19 20 21 |
# File 'lib/alfi/providers/base.rb', line 19 def add_to_list(helper_string) $result_list << helper_string end |
#call ⇒ Object
15 16 17 |
# File 'lib/alfi/providers/base.rb', line 15 def call fail NotImplementedError end |
#query_url ⇒ Object
11 12 13 |
# File 'lib/alfi/providers/base.rb', line 11 def query_url fail NotImplementedError end |