lib/pupa/models/concerns/nameable.rb in pupa-0.1.7 vs lib/pupa/models/concerns/nameable.rb in pupa-0.1.8
- old
+ new
@@ -22,22 +22,46 @@
end
# Adds an alternate or former name.
#
# @param [String] name an alternate or former name
- # @param [Date,Time] start_date the date on which the name was adopted
- # @param [Date,Time] end_date the date on which the name was abandoned
+ # @param [String,Date,Time] start_date the date on which the name was adopted
+ # @param [String,Date,Time] end_date the date on which the name was abandoned
# @param [String] note a note, e.g. "Birth name"
- def add_name(name, start_date: nil, end_date: nil, note: nil)
+ # @param [String] family_name one or more family names
+ # @param [String] given_name one or more primary given names
+ # @param [String] additional_name one or more secondary given names
+ # @param [String] honorific_prefix one or more honorifics preceding a person's name
+ # @param [String] honorific_suffix one or more honorifics following a person's name
+ # @param [String] patronymic_name one or more patronymic names
+ def add_name(name, start_date: nil, end_date: nil, note: nil, family_name: nil, given_name: nil, additional_name: nil, honorific_prefix: nil, honorific_suffix: nil, patronymic_name: nil)
data = {name: name}
if start_date
data[:start_date] = start_date
end
if end_date
data[:end_date] = end_date
end
if note
data[:note] = note
+ end
+ if family_name
+ data[:family_name] = family_name
+ end
+ if given_name
+ data[:given_name] = given_name
+ end
+ if additional_name
+ data[:additional_name] = additional_name
+ end
+ if honorific_prefix
+ data[:honorific_prefix] = honorific_prefix
+ end
+ if honorific_suffix
+ data[:honorific_suffix] = honorific_suffix
+ end
+ if patronymic_name
+ data[:patronymic_name] = patronymic_name
end
if name.present?
@other_names << data
end
end