Module: Pupa::Concerns::Identifiable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Organization, Person
- Defined in:
- lib/pupa/models/concerns/identifiable.rb
Overview
Adds the Popolo identifiers
property to a model.
Instance Method Summary collapse
-
#add_identifier(identifier, scheme: nil) ⇒ Object
Adds an issued identifier.
-
#identifiers=(identifiers) ⇒ Object
Sets the identifiers.
- #initialize(*args) ⇒ Object
Instance Method Details
#add_identifier(identifier, scheme: nil) ⇒ Object
Adds an issued identifier.
28 29 30 31 32 33 34 35 36 |
# File 'lib/pupa/models/concerns/identifiable.rb', line 28 def add_identifier(identifier, scheme: nil) data = {identifier: identifier} if scheme data[:scheme] = scheme end if identifier.present? @identifiers << data end end |
#identifiers=(identifiers) ⇒ Object
Sets the identifiers.
20 21 22 |
# File 'lib/pupa/models/concerns/identifiable.rb', line 20 def identifiers=(identifiers) @identifiers = IdentifierList.new(symbolize_keys(identifiers)) end |
#initialize(*args) ⇒ Object
12 13 14 15 |
# File 'lib/pupa/models/concerns/identifiable.rb', line 12 def initialize(*args) @identifiers = IdentifierList.new super end |