Class: Locabulary::FacetWrapperForItem
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Locabulary::FacetWrapperForItem
- Extended by:
- Forwardable
- Defined in:
- lib/locabulary/facet_wrapper_for_item.rb
Overview
A wrapper for a Locabulary::Items::Base that includes information from the SOLR Utility.
Instance Attribute Summary collapse
-
#__faceted_node__ ⇒ Object
readonly
Returns the value of attribute faceted_node.
-
#__locabulary_item__ ⇒ Object
readonly
Returns the value of attribute locabulary_item.
Class Method Summary collapse
-
.build_for_faceted_node(options = {}) ⇒ Object
In some cases, we may have a facet with a term_label that is not found in the existing data storage.
-
.build_for_faceted_node_and_locabulary_item(options = {}) ⇒ Object
In some cases, we have a facet and a locabulary item and this is the public method for building the wrapped object.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FacetWrapperForItem
constructor
A new instance of FacetWrapperForItem.
Constructor Details
#initialize(options = {}) ⇒ FacetWrapperForItem
Returns a new instance of FacetWrapperForItem.
48 49 50 51 52 |
# File 'lib/locabulary/facet_wrapper_for_item.rb', line 48 def initialize( = {}) @__faceted_node__ = .fetch(:faceted_node) @__locabulary_item__ = .fetch(:locabulary_item) super(@__locabulary_item__) end |
Instance Attribute Details
#__faceted_node__ ⇒ Object (readonly)
Returns the value of attribute faceted_node.
54 55 56 |
# File 'lib/locabulary/facet_wrapper_for_item.rb', line 54 def __faceted_node__ @__faceted_node__ end |
#__locabulary_item__ ⇒ Object (readonly)
Returns the value of attribute locabulary_item.
54 55 56 |
# File 'lib/locabulary/facet_wrapper_for_item.rb', line 54 def __locabulary_item__ @__locabulary_item__ end |
Class Method Details
.build_for_faceted_node(options = {}) ⇒ Object
In some cases, we may have a facet with a term_label that is not found in the existing data storage. Instead of throwing an exception, we can make a reasonable approximation for that item based on the given parameters.
22 23 24 25 26 27 28 |
# File 'lib/locabulary/facet_wrapper_for_item.rb', line 22 def self.build_for_faceted_node( = {}) predicate_name = .fetch(:predicate_name) faceted_node = .fetch(:faceted_node) term_label = .fetch(:term_label) locabulary_item = Item.build(predicate_name: predicate_name, term_label: term_label, default_presentation_sequence: nil) new(faceted_node: faceted_node, locabulary_item: locabulary_item) end |
.build_for_faceted_node_and_locabulary_item(options = {}) ⇒ Object
In some cases, we have a facet and a locabulary item and this is the public method for building the wrapped object.
41 42 43 |
# File 'lib/locabulary/facet_wrapper_for_item.rb', line 41 def self.build_for_faceted_node_and_locabulary_item( = {}) new() end |