Class: SortedSearch::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/sorted_search/providers/provider.rb

Overview

base class for printers

Direct Known Subclasses

CocoapodsProvider, GithubProvider

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(specs, sorting_criteria) ⇒ Provider

Returns a new instance of Provider.



11
12
13
14
# File 'lib/sorted_search/providers/provider.rb', line 11

def initialize(specs, sorting_criteria)
  @specs = specs
  @sorting_criteria = sorting_criteria
end

Instance Attribute Details

#sorting_criteriaObject (readonly)

Returns the value of attribute sorting_criteria.



9
10
11
# File 'lib/sorted_search/providers/provider.rb', line 9

def sorting_criteria
  @sorting_criteria
end

Instance Method Details

#fetch_dataObject

private



23
24
25
26
27
28
# File 'lib/sorted_search/providers/provider.rb', line 23

def fetch_data
  found = "\nFound " + @specs.count.to_s + " specs. Fetching GitHub info, wait a moment please.\n"
  Pod::UI.puts found.green

  @progress_bar = ProgressBar.create(total: @specs.count, length: 60)
end

#pod_from_spec(spec) ⇒ Object



33
34
35
# File 'lib/sorted_search/providers/provider.rb', line 33

def pod_from_spec(spec)
  Pod::Specification::Set::Presenter.new(spec)
end

#provide_sorted_specsObject



16
17
18
19
# File 'lib/sorted_search/providers/provider.rb', line 16

def provide_sorted_specs
  fetch_data
  sort_specs
end

#sort_specsObject



30
31
# File 'lib/sorted_search/providers/provider.rb', line 30

def sort_specs
end