Class: Esearch::Presenter::Facet
- Inherits:
-
Esearch::Presenter
- Object
- Esearch::Presenter
- Esearch::Presenter::Facet
- Defined in:
- lib/esearch/presenter/facet.rb
Overview
Base class for facets in results
Defined Under Namespace
Constant Summary collapse
- TYPE_KEY =
'_type'.freeze
Class Method Summary collapse
-
.build(raw) ⇒ Facet
private
Build facet from raw.
Instance Method Summary collapse
-
#aspects ⇒ Enumerable<Aspect>
private
Enumerate aspects.
Class Method Details
.build(raw) ⇒ Facet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build facet from raw
17 18 19 20 |
# File 'lib/esearch/presenter/facet.rb', line 17 def self.build(raw) type = raw.fetch(TYPE_KEY) get(type).new(raw) end |
Instance Method Details
#aspects ⇒ Enumerable<Aspect>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Enumerate aspects
43 44 45 46 47 48 |
# File 'lib/esearch/presenter/facet.rb', line 43 def aspects util = self.class raw.fetch(util::FACET_KEY).map do |item| util::ASPECT_CLASS.new(item) end end |