Class: ModsDisplay::RelatedItem
- Includes:
- RelatedItemConcerns
- Defined in:
- lib/mods_display/fields/related_item.rb
Defined Under Namespace
Classes: ValueRenderer
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(related_item_elements, value_renderer: ValueRenderer) ⇒ RelatedItem
constructor
A new instance of RelatedItem.
Methods inherited from Field
Constructor Details
#initialize(related_item_elements, value_renderer: ValueRenderer) ⇒ RelatedItem
Returns a new instance of RelatedItem.
7 8 9 10 |
# File 'lib/mods_display/fields/related_item.rb', line 7 def initialize(, value_renderer: ValueRenderer) super() @value_renderer = value_renderer end |
Instance Method Details
#fields ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mods_display/fields/related_item.rb', line 12 def fields return_fields = RelatedItemValue.for_stanford_mods_elements(@stanford_mods_elements).map do || next if .collection? next if () text = @value_renderer.new().render next if text.nil? || text.empty? ModsDisplay::Values.new( label: (), values: [text] ) end.compact collapse_fields(return_fields) end |