Module: Uva::ModsIndexMethods
- Defined in:
- lib/uva/mods_index_methods.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#extract_person_full_names_and_computing_ids ⇒ Object
extracts the last_name##full_name##computing_id to be used by home view.
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/uva/mods_index_methods.rb', line 5 def self.included(base) ActiveSupport::Deprecation.warn("Uva::ModsIndexMethods has been deprecated and its functionality has been encorporated into Hydra::Datastream::ModsArticle") end |
Instance Method Details
#extract_person_full_names_and_computing_ids ⇒ Object
extracts the last_name##full_name##computing_id to be used by home view
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/uva/mods_index_methods.rb', line 10 def extract_person_full_names_and_computing_ids names = {} self.find_by_terms(:person).each do |person| name_parts = person.children.inject({}) do |hash,child| hash[child.get_attribute(:type)] = child.text if ["family","given"].include? child.get_attribute(:type) hash["computing_id"] = child.text if child.name == 'computing_id' hash end if name_parts.length == 3 and person.search(:roleTerm).children.text.include?("Author") if name_parts["family"].blank? && name_parts["given"].blank? && name_parts["computing_id"].blank? value = "Unknown Author" else value = "#{name_parts["family"]}, #{name_parts["given"]} (#{name_parts["computing_id"]})" end ::Solrizer::Extractor.insert_solr_field_value(names, "person_full_name_cid_facet", value) if name_parts.length == 3 end end names end |