Class: Carddav::Card
- Inherits:
-
Object
- Object
- Carddav::Card
- Defined in:
- lib/carddav/card.rb
Instance Attribute Summary collapse
-
#parsed ⇒ Object
readonly
Returns the value of attribute parsed.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
- #email ⇒ Object
- #image ⇒ Object
-
#initialize(data) ⇒ Card
constructor
A new instance of Card.
- #name ⇒ Object
Constructor Details
#initialize(data) ⇒ Card
Returns a new instance of Card.
8 9 10 11 |
# File 'lib/carddav/card.rb', line 8 def initialize(data) @raw = data.to_s @parsed = VCardigan.parse self.class.normalize(data) end |
Instance Attribute Details
#parsed ⇒ Object (readonly)
Returns the value of attribute parsed.
2 3 4 |
# File 'lib/carddav/card.rb', line 2 def parsed @parsed end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
2 3 4 |
# File 'lib/carddav/card.rb', line 2 def raw @raw end |
Class Method Details
.normalize(data) ⇒ Object
4 5 6 |
# File 'lib/carddav/card.rb', line 4 def self.normalize(data) data.to_s.gsub '
', '' end |
Instance Method Details
#email ⇒ Object
17 18 19 |
# File 'lib/carddav/card.rb', line 17 def email vcard_field :email end |
#image ⇒ Object
21 22 23 |
# File 'lib/carddav/card.rb', line 21 def image vcard_field :photo end |
#name ⇒ Object
13 14 15 |
# File 'lib/carddav/card.rb', line 13 def name vcard_field :fn end |