converts component to yaml style component for yaml parser consumption
# File lib/ziya/gauges/support/base.rb, line 7
7: def to_comp_yaml( name, indent_multiplier=1 )
8: buff = []
9: tab = indent( indent_multiplier )
10: buff << "#{dial( self.class.name.demodulize, name )}"
11: options.each_pair do |k,v|
12: if v.is_a? YAML::Omap
13: buff << "#{tab}#{indent}#{dials}"
14: v.each do |name, comp|
15: buff << "#{tab}#{indent(2)}#{dial( comp.class.name.demodulize, name )}"
16: comp.options.each_pair { |k,v| buff << "#{tab}#{indent(4)}#{k}: #{v}"}
17: end
18: else
19: buff << "#{tab}#{indent(1)}#{k}: #{v}" if options[k] and !options[k].to_s.empty?
20: end
21: end
22: buff.join( "\n" )
23: end
--- SEC00152
--- ""
---
- methods:
- visibility: public
aref: M000069
name: to_comp_yaml
sourcecode: " <span class=\"ruby-comment cmt\"># File lib/ziya/gauges/support/base.rb, line 7</span>\n 7: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_comp_yaml</span>( <span class=\"ruby-identifier\">name</span>, <span class=\"ruby-identifier\">indent_multiplier</span>=<span class=\"ruby-value\">1</span> )\n 8: <span class=\"ruby-identifier\">buff</span> = []\n 9: <span class=\"ruby-identifier\">tab</span> = <span class=\"ruby-identifier\">indent</span>( <span class=\"ruby-identifier\">indent_multiplier</span> )\n\
10: <span class=\"ruby-identifier\">buff</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-node\">"#{dial( self.class.name.demodulize, name )}"</span>\n\
11: <span class=\"ruby-identifier\">options</span>.<span class=\"ruby-identifier\">each_pair</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">k</span>,<span class=\"ruby-identifier\">v</span><span class=\"ruby-operator\">|</span>\n\
12: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">v</span>.<span class=\"ruby-identifier\">is_a?</span> <span class=\"ruby-constant\">YAML</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Omap</span>\n\
13: <span class=\"ruby-identifier\">buff</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-node\">"#{tab}#{indent}#{dials}"</span>\n\
14: <span class=\"ruby-identifier\">v</span>.<span class=\"ruby-identifier\">each</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">name</span>, <span class=\"ruby-identifier\">comp</span><span class=\"ruby-operator\">|</span>\n\
15: <span class=\"ruby-identifier\">buff</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-node\">"#{tab}#{indent(2)}#{dial( comp.class.name.demodulize, name )}"</span>\n\
16: <span class=\"ruby-identifier\">comp</span>.<span class=\"ruby-identifier\">options</span>.<span class=\"ruby-identifier\">each_pair</span> { <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">k</span>,<span class=\"ruby-identifier\">v</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-identifier\">buff</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-node\">"#{tab}#{indent(4)}#{k}: #{v}"</span>}\n\
17: <span class=\"ruby-keyword kw\">end</span> \n\
18: <span class=\"ruby-keyword kw\">else</span>\n\
19: <span class=\"ruby-identifier\">buff</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-node\">"#{tab}#{indent(1)}#{k}: #{v}"</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">k</span>] <span class=\"ruby-keyword kw\">and</span> <span class=\"ruby-operator\">!</span><span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">k</span>].<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">empty?</span>\n\
20: <span class=\"ruby-keyword kw\">end</span>\n\
21: <span class=\"ruby-keyword kw\">end</span>\n\
22: <span class=\"ruby-identifier\">buff</span>.<span class=\"ruby-identifier\">join</span>( <span class=\"ruby-value str\">"\\n"</span> )\n\
23: <span class=\"ruby-keyword kw\">end</span>"
m_desc: |-
<hr size="10"></hr><p>
converts component to yaml style component for yaml parser consumption
</p>
params: ( name, indent_multiplier=1 )
category: Instance
type: Public
---
Generated with the Darkfish Rdoc Generator.