Module: VisitCard::Models::VcardEmail::InstanceMethods

Defined in:
lib/visit_card/models/vcard_email.rb

Instance Method Summary collapse

Instance Method Details

#to_hcard(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/visit_card/models/vcard_email.rb', line 13

def to_hcard(options = {})
  result = []
  result << "<span class='type'>#{types.join(', ').titleize}</span>" unless types.empty?
  tag_name = options.fetch(:tag_name, 'a')
  result << "<#{tag_name} class='value' href='mailto:#{value}'>#{value}</#{tag_name}>"
  main_tag_name = options.fetch(:main_tag_name, 'div')
  ("<#{main_tag_name} class='email'>" << result.join(' ') << "</#{main_tag_name}>").html_safe
end