Module: YMaps::ActionView::YMapsMLHelper

Included in:
Helpers
Defined in:
lib/ymaps/action_view/ymapsml_helper.rb

Instance Method Summary collapse

Instance Method Details

#ymapsml(options = {}, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ymaps/action_view/ymapsml_helper.rb', line 10

def ymapsml(options = {}, &block)
  xml = options.delete(:xml) { eval('xml', block.binding)  }
  xml.instruct!

  ymapsml_opts = {
    'xml:lang' => options.fetch(:language) { 'en-US' },
    'xmlns' => YMAPS_XMLNS,
    'xmlns:gml' => GML_XMLNS,
    'xmlns:repr' => REPR_XMLNS
  }
  ymapsml_opts.merge!(options).reject! { |key, value| !key.match(/^xml/) }

  xml.ymaps(ymapsml_opts) do
    yield YMapsBuilder.new(xml, self, options)
  end
end