Class: NTEE::HierarchicalDimensionValue
- Inherits:
-
SearchDimensions::HierarchicalValue
- Object
- SearchDimensions::HierarchicalValue
- NTEE::HierarchicalDimensionValue
- Defined in:
- lib/ntee/search_dimension.rb
Class Method Summary collapse
Instance Method Summary collapse
- #category ⇒ Object
- #facet_children(search) ⇒ Object
- #label ⇒ Object
- #param_value ⇒ Object
- #value=(new_value) ⇒ Object
Class Method Details
.values_for_category(category) ⇒ Object
26 27 28 |
# File 'lib/ntee/search_dimension.rb', line 26 def self.values_for_category(category) values_for_path((category.ancestors.reverse + [category]).map(&:code)) end |
Instance Method Details
#category ⇒ Object
11 12 13 |
# File 'lib/ntee/search_dimension.rb', line 11 def category NTEE.category(leaf_value) end |
#facet_children(search) ⇒ Object
38 39 40 |
# File 'lib/ntee/search_dimension.rb', line 38 def facet_children(search) super.sort_by(&:label) end |
#label ⇒ Object
30 31 32 |
# File 'lib/ntee/search_dimension.rb', line 30 def label category ? category.name : super end |
#param_value ⇒ Object
34 35 36 |
# File 'lib/ntee/search_dimension.rb', line 34 def param_value category ? category.code : super end |
#value=(new_value) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ntee/search_dimension.rb', line 15 def value=(new_value) category = NTEE.category(new_value) if category # we got an NTEE code as our value, let's convert it to a hierarchical path self.value = self.class.values_for_category(category).last else super end end |