Class: Ziya::Gauges::Support::Base

Inherits:
Charts::Support::Base show all
Includes:
YamlHelpers::Gauges
Defined in:
lib/ziya/gauges/support/base.rb

Direct Known Subclasses

Circle, Design, Image, Line, Link, Move, Point, Polygon, RadialBase, Rect, Rotate, Scale, Text, Update

Instance Method Summary collapse

Methods included from YamlHelpers::Gauges

#dial, #dials, #gauge

Methods included from YamlHelpers::Base

#clazz, #indent

Methods inherited from Charts::Support::Base

#==, attributes, #attributes_for, #configured?, #flatten, 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

#to_comp_yaml(name, indent_multiplier = 1) ⇒ Object


converts component to yaml style component for yaml parser consumption



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ziya/gauges/support/base.rb', line 7

def to_comp_yaml( name, indent_multiplier=1 )
  buff = []
  tab  = indent( indent_multiplier )
  buff << "#{dial( self.class.name.ziya_demodulize, name )}"
  options.each_pair do |k,v|
    if v.is_a? YAML::Omap
      buff << "#{tab}#{indent}#{dials}"
      v.each do |comp_name, comp|
        buff << "#{tab}#{indent(2)}#{dial( comp.class.name.ziya_demodulize, comp_name )}"
        comp.options.each_pair { |key,val| buff << "#{tab}#{indent(4)}#{key}: #{val}"}
      end          
    else
      buff << "#{tab}#{indent(1)}#{k}: #{v}" if options[k] and !options[k].to_s.empty?
    end
  end
  buff.join( "\n" )
end