Class: GSA::ReadableFacets

Inherits:
ReadableResults show all
Defined in:
lib/gsa/readable_results/readable_facets.rb

Class Method Summary collapse

Methods inherited from ReadableResults

parse_core

Methods included from Injector

#inject, #inject_a, #inject_s

Class Method Details

.convert(facet) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/gsa/readable_results/readable_facets.rb', line 12

def self.convert(facet)
  {
    :facet_raw_name     => facet[GSA::FACET_RAW_NAME],
    :facet_display_name => facet[GSA::FACET_DISPLAY_NAME],
    :facet_is_range     => facet[GSA::FACET_IS_RANGE],
    :facet_type         => facet[GSA::FACET_TYPE],
    :buckets            => ReadableBuckets::parse(facet)
  }
end

.extract(search_results) ⇒ Object



4
5
6
# File 'lib/gsa/readable_results/readable_facets.rb', line 4

def self.extract(search_results)
  (search_results[GSA::FACETS].select {|key, value| key == GSA::FACET })[GSA::FACET]
end

.parse(facets) ⇒ Object



8
9
10
# File 'lib/gsa/readable_results/readable_facets.rb', line 8

def self.parse(facets)
  parse_core(facets) {|facet| convert(facet) }
end