Module: VisitCard::Models::VcardAdr::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#adrObject



13
14
15
16
# File 'lib/visit_card/models/vcard_adr.rb', line 13

def adr
  # "#{post_office_box};#{extended_address};#{street_address};#{locality};#{region};#{postal_code};#{country_name}"
  SERIALZABLE_ATTRIBUTES.join(';')
end

#to_hcard(options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/visit_card/models/vcard_adr.rb', line 18

def to_hcard(options = {})
  result = []
  result << "<span class='type'>#{types.join(', ').titleize}</span>" unless types.empty?
  tag_name = options.fetch(:tag_name, 'span')
  SERIALZABLE_ATTRIBUTES.each do |attr_name|
    result << wrap_attribute(attr_name, tag_name)
  end
  result.compact!
  main_tag_name = options.fetch(:main_tag_name, 'div')
  ("<#{main_tag_name} class='adr'>" << result.join(' ') << "</#{main_tag_name}>").html_safe
end