Class: YMaps::ActionView::YMapsReprBuilder
- Inherits:
-
YMapsBuilder
- Object
- Builder
- YMapsBuilder
- YMaps::ActionView::YMapsReprBuilder
- Defined in:
- lib/ymaps/action_view/ymapsml_helper.rb
Constant Summary collapse
- ACCEPTABLE_STYLES =
{ :balloon_content => [:template], :hint_content => [:template], :icon => [:href, :offset, :shadow, :size, :template], :icon_content => [:template], :line => [:stroke_color, :stroke_width], :polygon => [:fill, :fill_color, :outline, :stroke_color, :stroke_width], }
Constants inherited from Builder
Builder::GML_TAG_NAMES, Builder::REPR_TAG_NAMES, Builder::YMAPS_TAG_NAMES
Instance Method Summary collapse
-
#style(id, options = {}) ⇒ Object
Add style definition.
- #template(id, template_text = nil) ⇒ Object
- #view(options = {}) ⇒ Object
Methods inherited from YMapsBuilder
#bounds, #collection, #initialize, #meta_data, #object, #point, #representation
Methods inherited from Builder
Constructor Details
This class inherits a constructor from YMaps::ActionView::YMapsBuilder
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class YMaps::ActionView::Builder
Instance Method Details
#style(id, options = {}) ⇒ Object
Add style definition
144 145 146 147 148 149 150 151 152 |
# File 'lib/ymaps/action_view/ymapsml_helper.rb', line 144 def style(id, = {}) [:hasBalloon] = .delete(:balloon) if .key?(:balloon) [:hasHint] = .delete(:hint) if .key?(:hint) parent = .delete(:parent) { false } Style(.merge('gml:id' => id.to_s)) { link_to(:parentStyle, parent) if parent yield } end |
#template(id, template_text = nil) ⇒ Object
163 164 165 166 167 168 169 |
# File 'lib/ymaps/action_view/ymapsml_helper.rb', line 163 def template(id, template_text = nil) Template('gml:id' => id.to_s) do text do cdata!(template_text || yield) end end end |
#view(options = {}) ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/ymaps/action_view/ymapsml_helper.rb', line 133 def view( = {}) View { mapType([:type].to_s.upcase) if [:type] bounds([:bounds]) if [:bounds] yield if block_given? } end |