Module: VisitCard::Models::VcardTel::InstanceMethods

Defined in:
lib/visit_card/models/vcard_tel.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_tel.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, 'span')
  result << "<#{tag_name} class='value'>#{value}</#{tag_name}>"
  main_tag_name = options.fetch(:main_tag_name, 'div')
  ("<#{main_tag_name} class='tel'>" << result.join(' ') << "</#{main_tag_name}>").html_safe
end