Module: Ecfr::FacetAttributeMethodDefinition
- Included in:
- SearchService::DateFacet, SearchService::TitleFacet
- Defined in:
- lib/ecfr/facet_attribute_method_definition.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/ecfr/facet_attribute_method_definition.rb', line 20 def self.included(base) base.instance_eval do class_attribute :fk class_attribute :fv end base.extend(ClassMethods) end |
Instance Method Details
#count_for(key) ⇒ Object
43 44 45 |
# File 'lib/ecfr/facet_attribute_method_definition.rb', line 43 def count_for(key) attributes[self.class.result_root][key] end |
#initialize(results, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ecfr/facet_attribute_method_definition.rb', line 29 def initialize(results, = {}) = {base: true} = .merge() if ![:base] key, value = results results = {} results[self.class.fk] = key results[self.class.fv] = value end super(results, ) end |