Module: Stanford::Mods::Name
- Included in:
- Record
- Defined in:
- lib/stanford-mods/concerns/name.rb
Instance Method Summary collapse
-
#sw_addl_authors ⇒ Array<String>
all names, in display form, except the main_author names will be the display_value_w_date form see Mods::Record.name in nom_terminology for details on the display_value algorithm.
-
#sw_corporate_authors ⇒ Array<String>
Values for author_corp_display.
-
#sw_impersonal_authors ⇒ Array<String>
return the display_value_w_date for all <mods><name> elements that do not have type=‘personal’.
-
#sw_main_author ⇒ String
the first encountered <mods><name> element with marcrelator flavor role of ‘Creator’ or ‘Author’.
-
#sw_meeting_authors ⇒ Array<String>
Values for author_meeting_display.
-
#sw_person_authors ⇒ Array<String>
Values for author_person_facet, author_person_display.
-
#sw_sort_author ⇒ String
Returns a sortable version of the main_author: main_author + sorting title which is the mods approximation of the value created for a marc record.
Instance Method Details
#sw_addl_authors ⇒ Array<String>
all names, in display form, except the main_author
names will be the display_value_w_date form
see Mods::Record.name in nom_terminology for details on the display_value algorithm
22 23 24 |
# File 'lib/stanford-mods/concerns/name.rb', line 22 def mods_ng_xml.plain_name.map(&:display_value_w_date) - [] end |
#sw_corporate_authors ⇒ Array<String>
Returns values for author_corp_display.
38 39 40 |
# File 'lib/stanford-mods/concerns/name.rb', line 38 def mods_ng_xml.corporate_name.map(&:display_value_w_date) end |
#sw_impersonal_authors ⇒ Array<String>
return the display_value_w_date for all <mods><name> elements that do not have type=‘personal’
33 34 35 |
# File 'lib/stanford-mods/concerns/name.rb', line 33 def mods_ng_xml.plain_name.select { |n| n.type_at != 'personal' }.map(&:display_value_w_date) end |
#sw_main_author ⇒ String
the first encountered <mods><name> element with marcrelator flavor role of ‘Creator’ or ‘Author’. if no marcrelator ‘Creator’ or ‘Author’, the first name without a role. if no name without a role, then nil
11 12 13 14 15 16 |
# File 'lib/stanford-mods/concerns/name.rb', line 11 def result = mods_ng_xml.plain_name.find { |n| n.role.any? { |r| r..include?('marcrelator') && r.value.any? { |v| v.match(/creator/i) || v.match?(/author/i) } } } result ||= mods_ng_xml.plain_name.find { |n| n.role.empty? } result&.display_value_w_date end |
#sw_meeting_authors ⇒ Array<String>
Returns values for author_meeting_display.
43 44 45 |
# File 'lib/stanford-mods/concerns/name.rb', line 43 def mods_ng_xml.conference_name.map(&:display_value_w_date) end |
#sw_person_authors ⇒ Array<String>
Returns values for author_person_facet, author_person_display.
27 28 29 |
# File 'lib/stanford-mods/concerns/name.rb', line 27 def mods_ng_xml.personal_name.map(&:display_value_w_date) end |
#sw_sort_author ⇒ String
Returns a sortable version of the main_author:
main_author + sorting title
which is the mods approximation of the value created for a marc record
51 52 53 54 |
# File 'lib/stanford-mods/concerns/name.rb', line 51 def # substitute java Character.MAX_CODE_POINT for nil main_author so missing main authors sort last "#{ || "\u{10FFFF} " }#{sort_title}".gsub(/[[:punct:]]*/, '').strip end |