Class: Ziya::Maps::Support::Base
- Inherits:
-
Charts::Support::Base
- Object
- Charts::Support::Base
- Ziya::Maps::Support::Base
- Includes:
- YamlHelpers::Gauges
- Defined in:
- lib/ziya/maps/support/base.rb
Direct Known Subclasses
ArcColor, ArcRange, BackgroundColor, DefaultColor, DefaultPoint, FirstZoom, HeatRange, Hover, Line, LineColor, LineRange, OutlineColor, Point, PointRange, Range, Ranges, Region, ScalePoints, ShowName, State, StateInfoIcon, ZoomMode, ZoomOutButton, ZoomOutScale
Instance Method Summary collapse
-
#flatten(xml) ⇒ Object
flatten component to xml.
-
#to_comp_yaml(indent_multiplier = 1) ⇒ Object
———————————————————————– converts component to yaml style component for yaml parser consumption.
Methods included from YamlHelpers::Gauges
Methods included from YamlHelpers::Base
Methods inherited from Charts::Support::Base
#==, attributes, #attributes_for, #configured?, has_attribute, #has_sub_components, #initialize, #merge, #options, #options_as_string
Constructor Details
This class inherits a constructor from Ziya::Charts::Support::Base
Instance Method Details
#flatten(xml) ⇒ Object
flatten component to xml
8 9 10 11 12 |
# File 'lib/ziya/maps/support/base.rb', line 8 def flatten( xml ) xml.state( :id => to_component_id ) do |state| .keys.sort { |a,b| a.to_s <=> b.to_s }.each{ |k| self.class.module_eval "xml.#{k}( '#{[k]}' )" } end end |
#to_comp_yaml(indent_multiplier = 1) ⇒ Object
converts component to yaml style component for yaml parser consumption
16 17 18 19 20 21 22 23 24 |
# File 'lib/ziya/maps/support/base.rb', line 16 def to_comp_yaml( indent_multiplier=1 ) buff = [] tab = indent( indent_multiplier ) buff << "#{dial( self.class.name.ziya_demodulize, name )}" .each_pair do |k,v| buff << "#{tab}#{k}: #{v}" if [k] and ![k].to_s.empty? end buff.join( "\n" ) end |