Class: Valerie::Card
- Inherits:
-
Object
- Object
- Valerie::Card
- Extended by:
- Valerie::Core::Parser
- Defined in:
- lib/valerie/card.rb
Instance Attribute Summary collapse
-
#birthday ⇒ Object
Returns the value of attribute birthday.
-
#formatted_name ⇒ Object
readonly
Returns the value of attribute formatted_name.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#name ⇒ Object
Returns the value of attribute name.
-
#organization ⇒ Object
Returns the value of attribute organization.
Instance Method Summary collapse
Methods included from Valerie::Core::Parser
Instance Attribute Details
#birthday ⇒ Object
Returns the value of attribute birthday.
8 9 10 |
# File 'lib/valerie/card.rb', line 8 def birthday @birthday end |
#formatted_name ⇒ Object (readonly)
Returns the value of attribute formatted_name.
8 9 10 |
# File 'lib/valerie/card.rb', line 8 def formatted_name @formatted_name end |
#gender ⇒ Object
Returns the value of attribute gender.
8 9 10 |
# File 'lib/valerie/card.rb', line 8 def gender @gender end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/valerie/card.rb', line 8 def name @name end |
#organization ⇒ Object
Returns the value of attribute organization.
8 9 10 |
# File 'lib/valerie/card.rb', line 8 def organization @organization end |
Instance Method Details
#addresses ⇒ Object
44 45 46 |
# File 'lib/valerie/card.rb', line 44 def addresses @addresses ||= Collection::AddressCollection.new end |
#emails ⇒ Object
40 41 42 |
# File 'lib/valerie/card.rb', line 40 def emails @emails ||= Collection::EmailCollection.new end |
#phones ⇒ Object
48 49 50 |
# File 'lib/valerie/card.rb', line 48 def phones @phones ||= Collection::PhoneCollection.new end |
#to_a ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/valerie/card.rb', line 56 def to_a parts = [ 'BEGIN:VCARD', "VERSION:#{Valerie.configuration.version}", "PRODID:-//#{Valerie.configuration.product}//#{Valerie.configuration.language}", ] parts << @name.to_s if @name parts << @organization.to_s if @organization parts << @birthday.to_s if @birthday parts << @gender.to_s if @gender emails.each do |email| parts << email.to_s end phones.each do |phone| parts << phone.to_s end addresses.each do |address| parts << address.to_s end parts << 'END:VCARD' parts end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/valerie/card.rb', line 52 def to_s to_a.join("\r\n") end |