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 10 |
# 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 @quote_symbol = $single_quotes ? "'" : "\"" request_extensions if self.class.method_defined?(:request_extensions) end |
Instance Method Details
#add_repo_to_list(package) ⇒ Object
28 29 30 |
# File 'lib/alfi/providers/base.rb', line 28 def add_repo_to_list(package) $result_list << " #{$prefix} #{@quote_symbol}#{package}#{@quote_symbol}".green end |
#add_suggestions(suggestions) ⇒ Object
24 25 26 |
# File 'lib/alfi/providers/base.rb', line 24 def add_suggestions(suggestions) $suggestions += Array(suggestions) end |
#add_to_list(helper_string) ⇒ Object
20 21 22 |
# File 'lib/alfi/providers/base.rb', line 20 def add_to_list(helper_string) $result_list << helper_string end |
#call ⇒ Object
16 17 18 |
# File 'lib/alfi/providers/base.rb', line 16 def call fail NotImplementedError end |
#query_url ⇒ Object
12 13 14 |
# File 'lib/alfi/providers/base.rb', line 12 def query_url fail NotImplementedError end |