Class: Postal::AddressFormatter::HTML

Inherits:
Text
  • Object
show all
Defined in:
lib/postal_address/formatters/html.rb

Constant Summary collapse

ItemType =
'http://schema.org/PostalAddress'
ItemProp =
{
  recipient: 'name',
  street:    'streetAddress',
  zip:       'postalCode',
  state:     'addressRegion',
  city:      'addressLocality',
  country:   'addressCountry'
}

Instance Attribute Summary

Attributes inherited from Text

#address

Instance Method Summary collapse

Methods inherited from Text

#initialize

Constructor Details

This class inherits a constructor from Postal::AddressFormatter::Text

Instance Method Details

#render(**params) ⇒ Object



14
15
16
17
18
# File 'lib/postal_address/formatters/html.rb', line 14

def render(**params)
  tagname = params.delete(:tag) || :p
  content = super.gsub("\n", "<br>")
  tag tagname, content, **params.merge(itemscope: nil, itemtype: ItemType)
end