Class: Govspeak::HCardPresenter
- Inherits:
-
Object
- Object
- Govspeak::HCardPresenter
- Defined in:
- lib/govspeak/presenters/h_card_presenter.rb
Instance Attribute Summary collapse
-
#contact_address ⇒ Object
readonly
Returns the value of attribute contact_address.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(contact_address) ⇒ HCardPresenter
constructor
A new instance of HCardPresenter.
- #interpolate_address_property(our_name, hcard_name) ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(contact_address) ⇒ HCardPresenter
Returns a new instance of HCardPresenter.
11 12 13 |
# File 'lib/govspeak/presenters/h_card_presenter.rb', line 11 def initialize(contact_address) @contact_address = contact_address end |
Instance Attribute Details
#contact_address ⇒ Object (readonly)
Returns the value of attribute contact_address.
9 10 11 |
# File 'lib/govspeak/presenters/h_card_presenter.rb', line 9 def contact_address @contact_address end |
Class Method Details
Instance Method Details
#interpolate_address_property(our_name, hcard_name) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/govspeak/presenters/h_card_presenter.rb', line 19 def interpolate_address_property(our_name, hcard_name) value = contact_address[our_name] if value.present? "<span class=\"#{hcard_name}\">#{ERB::Util.html_escape(value)}</span>" else "" end end |
#render ⇒ Object
15 16 17 |
# File 'lib/govspeak/presenters/h_card_presenter.rb', line 15 def render "<p class=\"adr\">\n#{interpolate_address_template}\n</p>\n".html_safe end |