Class: Crest::Card
- Inherits:
-
Object
- Object
- Crest::Card
- Defined in:
- lib/crest/card.rb
Overview
An organization's contact card, written as the vCard 3.0 a phone offers to save.
Constant Summary collapse
- FOLD =
What a line may hold before a vCard folds it, less the space that continues it.
74
Instance Method Summary collapse
-
#initialize(name:, phone:, url: nil, email: nil, org: nil, photo: nil) ⇒ Card
constructor
A new instance of Card.
-
#to_s ⇒ String
Card itself, CRLF-delimited and folded, as the format asks.
Constructor Details
#initialize(name:, phone:, url: nil, email: nil, org: nil, photo: nil) ⇒ Card
Returns a new instance of Card.
15 16 17 18 19 20 21 22 |
# File 'lib/crest/card.rb', line 15 def initialize(name:, phone:, url: nil, email: nil, org: nil, photo: nil) @name = name @phone = phone @url = url @email = email @org = org @photo = photo end |
Instance Method Details
#to_s ⇒ String
Returns card itself, CRLF-delimited and folded, as the format asks.
25 |
# File 'lib/crest/card.rb', line 25 def to_s = lines.flat_map { |line| fold line }.join("\r\n") << "\r\n" |