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
19 20 21 22 |
# File 'lib/esearch/presenter/facet.rb', line 19 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
45 46 47 48 |
# File 'lib/esearch/presenter/facet.rb', line 45 def aspects util = self.class raw.fetch(util::FACET_KEY).map(&util::ASPECT_CLASS.method(:new)) end |