Sha256: 332505e3569b41fe2110ba1c38effa9696fa7abace2540b458e66e4305caa44b
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
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 dump :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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pupa-0.0.9 | lib/pupa/models/concerns/contactable.rb |