Sha256: 3e0970b586bb74d9f15968a8bc4522a49d4c05ed568df3f99db4c74e72be889f
Contents?: true
Size: 1.04 KB
Versions: 11
Compression:
Stored size: 1.04 KB
Contents
class Ppl::Entity::Contact attr_accessor :id attr_accessor :name attr_accessor :nicknames attr_accessor :email_addresses attr_accessor :birthday attr_accessor :phone_numbers attr_accessor :organizations attr_accessor :postal_address attr_accessor :postal_addresses attr_accessor :urls def initialize @email_addresses = [] @nicknames = [] @organizations = [] @phone_numbers = [] @postal_addresses = [] @urls = [] end def set_postal_address if @postal_address.nil? @postal_address = Ppl::Entity::PostalAddress.new end yield @postal_address end def age(on_date) if @birthday.nil? nil else # From http://stackoverflow.com/a/2357790 on_date.year - @birthday.year - ((on_date.month > @birthday.month || (on_date.month == @birthday.month && on_date.day >= @birthday.day)) ? 0 : 1) end end def preferred_email_address @email_addresses.find { |e| e.preferred } end def preferred_phone_number @phone_numbers.find { |p| p.preferred } end end
Version data entries
11 entries across 11 versions & 1 rubygems