gsa 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- [:voltage, :brand, :material, :bulb_type, :bulb_color]
@@ -1 +0,0 @@
1
- [:voltage]
@@ -1 +0,0 @@
1
- {:voltage=>[["220", 2], ["120", 3], ["65", 2], ["135", 2], ["45", 5], ["140", 1], ["115", 1], ["110", 1], ["75", 1], ["100", 1]], :brand=>[["Plusrite", 4], ["Tcp", 3], ["Bulbrite", 3], ["Sylvania", 1], ["Eiko", 3], ["Philips", 4], ["Satco", 1]], :material=>[["Fabric", 4], ["Plastic", 1], ["Fiberglass", 1], ["Glass", 5], ["Resin", 1], ["Metal", 2], ["Brass", 1], ["Ceramic", 1], ["Wood", 3]], :bulb_type=>[["Flourescent", 4], ["Halogen", 2], ["Incandescent", 10], ["Led", 3]], :bulb_color=>[["Blue", 19]]}
@@ -1 +0,0 @@
1
- {:voltage=>[["220", 2], ["120", 3], ["65", 2], ["135", 2], ["45", 5], ["140", 1], ["115", 1], ["110", 1], ["75", 1], ["100", 1]]}
@@ -1,41 +0,0 @@
1
- module GSA
2
- class Faceter
3
- def self.facet(search_results, facetables=[])
4
- faceted = build_faceted(facetables)
5
-
6
- faceted = populate_faceted(search_results, facetables, faceted)
7
-
8
- faceted = group_faceted(facetables, faceted)
9
- end
10
-
11
- def self.build_faceted(facetables)
12
- faceted = {}
13
- facetables.each {|facetable| faceted[facetable] = []}
14
- faceted
15
- end
16
-
17
- def self.populate_faceted(search_results, facetables, faceted)
18
- search_results.each {|result| handle_metatags(result, facetables, faceted)}
19
- faceted
20
- end
21
-
22
- def self.handle_metatags(result, facetables, faceted)
23
- result[:metatags].each {|metatag| add_value_to_group(facetables, faceted, metatag)}
24
- end
25
-
26
- def self.add_value_to_group(facetables, faceted, metatag)
27
- if facetables.include? metatag[:meta_name].to_sym
28
- faceted[metatag[:meta_name].to_sym] << metatag[:meta_value]
29
- end
30
- end
31
-
32
- def self.group_faceted(facetables, faceted)
33
- facetables.each {|facetable| faceted[facetable] = sub_groups(faceted, facetable)}
34
- faceted
35
- end
36
-
37
- def self.sub_groups(faceted, facetable)
38
- faceted[facetable].group_by(&:capitalize).map {|k,v| [k, v.length]} # change capitalize to something less invasive (don't alter the original form)
39
- end
40
- end
41
- end