Class: HentryConsumer::HCard
- Defined in:
- lib/hentry_consumer/h_card.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
(also: #emails)
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
(also: #urls)
Returns the value of attribute url.
Attributes inherited from Element
Instance Method Summary collapse
- #parse_p_name(element) ⇒ Object
- #parse_u_email(element) ⇒ Object
- #parse_u_url(element) ⇒ Object
- #to_hash ⇒ Object
- #to_json(*a) ⇒ Object
Methods inherited from Element
#[], #[]=, #assign_value, #cleanse_classes, #initialize, #parse_element, #parse_elements, #parse_microformat, #to_html, #to_xml
Constructor Details
This class inherits a constructor from HentryConsumer::Element
Instance Attribute Details
#email ⇒ Object Also known as: emails
Returns the value of attribute email.
5 6 7 |
# File 'lib/hentry_consumer/h_card.rb', line 5 def email @email end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/hentry_consumer/h_card.rb', line 5 def name @name end |
#url ⇒ Object Also known as: urls
Returns the value of attribute url.
5 6 7 |
# File 'lib/hentry_consumer/h_card.rb', line 5 def url @url end |
Instance Method Details
#parse_p_name(element) ⇒ Object
9 10 11 |
# File 'lib/hentry_consumer/h_card.rb', line 9 def parse_p_name(element) assign_value :name, element.text end |
#parse_u_email(element) ⇒ Object
13 14 15 |
# File 'lib/hentry_consumer/h_card.rb', line 13 def parse_u_email(element) assign_value :email, element["href"] end |
#parse_u_url(element) ⇒ Object
17 18 19 |
# File 'lib/hentry_consumer/h_card.rb', line 17 def parse_u_url(element) assign_value :url, element["href"] end |
#to_hash ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hentry_consumer/h_card.rb', line 21 def to_hash { :type => ["h-card"], :properties => { :name => self.name, :email => self.email, :url => self.url } } end |
#to_json(*a) ⇒ Object
32 33 34 |
# File 'lib/hentry_consumer/h_card.rb', line 32 def to_json(*a) to_hash.to_json(a) end |