Sha256: 29216503aa153ce24c49d06fd50c3049a941fd728cba537acd1a9b3fd3aea92d
Contents?: true
Size: 917 Bytes
Versions: 8
Compression:
Stored size: 917 Bytes
Contents
module Pupa module Concerns # Adds the Popolo `other_names` property to a model. module Nameable extend ActiveSupport::Concern included do attr_accessor :other_names 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] note a note, e.g. "Birth name" def add_name(name, start_date: nil, end_date: nil, note: 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 name (@other_names ||= []) << data end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems