Sha256: 43c034b8c340ca86bf1434af3aed58c2615ac222f6c185bcc270784cd663efeb
Contents?: true
Size: 1001 Bytes
Versions: 8
Compression:
Stored size: 1001 Bytes
Contents
module Pupa module Concerns # Adds the Popolo `contact_details` property to a model. module Contactable extend ActiveSupport::Concern included do attr_reader :contact_details end # Sets the contact details. # # @param [Array] contact_details a list of contact details def contact_details=(contact_details) @contact_details = ContactDetailList.new(contact_details) end # Adds a contact detail. # # @param [String] type a type of medium, e.g. "fax" or "email" # @param [String] value a value, e.g. a phone number or email address # @param [String] note a note, e.g. for grouping contact details by physical location def add_contact_detail(type, value, note: nil) data = {type: type, value: value} if note data[:note] = note end if type && value (@contact_details ||= ContactDetailList.new) << data end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems