Module: CurationConcerns::CharacterizationBehavior

Extended by:
ActiveSupport::Concern
Included in:
FileSetPresenter
Defined in:
app/presenters/curation_concerns/characterization_behavior.rb

Instance Method Summary collapse

Instance Method Details

#additional_characterization_metadataObject

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"



37
38
39
# File 'app/presenters/curation_concerns/characterization_behavior.rb', line 37

def 
  @additional_characterization_metadata ||= {}
end

#characterization_metadataObject



26
27
28
# File 'app/presenters/curation_concerns/characterization_behavior.rb', line 26

def 
  @characterization_metadata ||= 
end

#characterized?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/presenters/curation_concerns/characterization_behavior.rb', line 22

def characterized?
  !.values.compact.empty?
end

#label_for_term(term) ⇒ Object



41
42
43
# File 'app/presenters/curation_concerns/characterization_behavior.rb', line 41

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.

Parameters:

  • term (Symbol)

    found in the characterization_metadata hash

Returns:

  • (Array)

    of truncated values



49
50
51
52
53
# File 'app/presenters/curation_concerns/characterization_behavior.rb', line 49

def primary_characterization_values(term)
  values = values_for(term)
  values.slice!(CurationConcerns.config.fits_message_length, (values.length - CurationConcerns.config.fits_message_length))
  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.

Parameters:

  • term (Symbol)

    found in the characterization_metadata hash

Returns:

  • (Array)

    of truncated values



59
60
61
62
63
64
# File 'app/presenters/curation_concerns/characterization_behavior.rb', line 59

def secondary_characterization_values(term)
  values = values_for(term)
  additional_values = values.slice(CurationConcerns.config.fits_message_length, values.length - CurationConcerns.config.fits_message_length)
  return [] unless additional_values
  truncate_all(additional_values)
end