Method: Microformats::Vcard#coordinates

Defined in:
lib/vcard.rb

#coordinates(lat, lng, opts = {}) ⇒ Object

Accepts latitude and longitude as arguments. It will only output a visible text node if you provide the :text option.

OPTIONS

  • :text - String, the text will be be displayed inside the ‘geo’ wrapper



135
136
137
138
139
140
141
142
# File 'lib/vcard.rb', line 135

def coordinates(lat, lng, opts = {})
  lat_meta = ('', :tag => :meta, :itemprop => 'latitude', :content => lat)
  lng_meta = ('', :tag => :meta, :itemprop => 'longitude', :content => lng)
  lat_span = (('', :class => 'value-title', :title => lat), :class => 'latitude')
  lng_span = (('', :class => 'value-title', :title => lng), :class => 'longitude')
  text = opts[:text] || ''
  (lat_meta + lng_meta + lat_span + lng_span + text, :class => 'geo', :itemprop => 'geo', :itemscope => 'itemscope', :itemtype => 'http://data-vocabulary.org/Geo')
end