Module: Hyrax::CharacterizationBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- FileSetPresenter
- Defined in:
- app/presenters/hyrax/characterization_behavior.rb
Instance Method Summary collapse
-
#additional_characterization_metadata ⇒ Object
Override this if you want to inject additional characterization metadata Use a hash of key/value pairs where the value is an Array or String { term1: [“value”], term2: [“value1”, “value2”], term3: “a string” }.
- #characterization_metadata ⇒ Object
- #characterized? ⇒ Boolean
- #label_for_term(term) ⇒ Object
-
#primary_characterization_values(term) ⇒ Array
Returns an array of characterization values truncated to 250 characters limited to the maximum number of configured values.
-
#secondary_characterization_values(term) ⇒ Array
Returns an array of characterization values truncated to 250 characters that are in excess of the maximum number of configured values.
Instance Method Details
#additional_characterization_metadata ⇒ Object
Override this if you want to inject additional characterization metadata Use a hash of key/value pairs where the value is an Array or String
term1: ["value"],
term2: ["value1", "value2"],
term3: "a string"
38 39 40 |
# File 'app/presenters/hyrax/characterization_behavior.rb', line 38 def @additional_characterization_metadata ||= {} end |
#characterization_metadata ⇒ Object
27 28 29 |
# File 'app/presenters/hyrax/characterization_behavior.rb', line 27 def @characterization_metadata ||= end |
#characterized? ⇒ Boolean
23 24 25 |
# File 'app/presenters/hyrax/characterization_behavior.rb', line 23 def characterized? !.values.compact.empty? end |
#label_for_term(term) ⇒ Object
42 43 44 |
# File 'app/presenters/hyrax/characterization_behavior.rb', line 42 def label_for_term(term) term.to_s.titleize end |
#primary_characterization_values(term) ⇒ Array
Returns an array of characterization values truncated to 250 characters limited to the maximum number of configured values.
50 51 52 53 54 |
# File 'app/presenters/hyrax/characterization_behavior.rb', line 50 def primary_characterization_values(term) values = values_for(term) values.slice!(Hyrax.config., (values.length - Hyrax.config.)) truncate_all(values) end |
#secondary_characterization_values(term) ⇒ Array
Returns an array of characterization values truncated to 250 characters that are in excess of the maximum number of configured values.
60 61 62 63 64 65 |
# File 'app/presenters/hyrax/characterization_behavior.rb', line 60 def secondary_characterization_values(term) values = values_for(term) additional_values = values.slice(Hyrax.config., values.length - Hyrax.config.) return [] unless additional_values truncate_all(additional_values) end |