Parent

Included Modules

Class Index

Quicksearch

Ziya::Maps::Support::Base

Public Instance Methods

flatten( xml ) click to toggle source

flatten component to xml

    # File lib/ziya/maps/support/base.rb, line 8
 8:     def flatten( xml )
 9:       xml.state( :id => to_component_id ) do |b|
10:         options.keys.sort { |a,b| a.to_s <=> b.to_s }.each{ |k| self.class.module_eval "xml.#{k}( '#{options[k]}' )" }
11:       end
12:     end
to_comp_yaml( indent_multiplier=1 ) click to toggle source


converts component to yaml style component for yaml parser consumption

    # File lib/ziya/maps/support/base.rb, line 16
16:     def to_comp_yaml( indent_multiplier=1 )
17:       buff = []
18:       tab  = indent( indent_multiplier )
19:       buff << "#{dial( self.class.name.demodulize, name )}"      
20:       options.each_pair do |k,v|
21:         buff << "#{tab}#{k}: #{v}" if options[k] and !options[k].to_s.empty?
22:       end
23:       buff.join( "\n" )
24:     end

Protected Instance Methods

to_component_id() click to toggle source

converts class name to underscore name

    # File lib/ziya/maps/support/base.rb, line 29
29:       def to_component_id
30:         class_name = self.class.name.underscore.split( "/" ).last
31:       end

secsequence

--- SEC00229

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000017
    name: flatten
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/maps/support/base.rb, line 8</span>\n 8:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">flatten</span>( <span class=\"ruby-identifier\">xml</span> )\n 9:       <span class=\"ruby-identifier\">xml</span>.<span class=\"ruby-identifier\">state</span>( <span class=\"ruby-identifier\">:id</span> =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-identifier\">to_component_id</span> ) <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">b</span><span class=\"ruby-operator\">|</span>\n\
      10:         <span class=\"ruby-identifier\">options</span>.<span class=\"ruby-identifier\">keys</span>.<span class=\"ruby-identifier\">sort</span> { <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">a</span>,<span class=\"ruby-identifier\">b</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-identifier\">a</span>.<span class=\"ruby-identifier\">to_s</span> <span class=\"ruby-operator\">&lt;=&gt;</span> <span class=\"ruby-identifier\">b</span>.<span class=\"ruby-identifier\">to_s</span> }.<span class=\"ruby-identifier\">each</span>{ <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">k</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">module_eval</span> <span class=\"ruby-node\">&quot;xml.#{k}( '#{options[k]}' )&quot;</span> }\n\
      11:       <span class=\"ruby-keyword kw\">end</span>\n\
      12:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      flatten component to xml
      </p>
    params: ( xml )
  - visibility: public
    aref: M000018
    name: to_comp_yaml
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/maps/support/base.rb, line 16</span>\n\
      16:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_comp_yaml</span>( <span class=\"ruby-identifier\">indent_multiplier</span>=<span class=\"ruby-value\">1</span> )\n\
      17:       <span class=\"ruby-identifier\">buff</span> = []\n\
      18:       <span class=\"ruby-identifier\">tab</span>  = <span class=\"ruby-identifier\">indent</span>( <span class=\"ruby-identifier\">indent_multiplier</span> )\n\
      19:       <span class=\"ruby-identifier\">buff</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-node\">&quot;#{dial( self.class.name.demodulize, name )}&quot;</span>      \n\
      20:       <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\
      21:         <span class=\"ruby-identifier\">buff</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-node\">&quot;#{tab}#{k}: #{v}&quot;</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\
      22:       <span class=\"ruby-keyword kw\">end</span>\n\
      23:       <span class=\"ruby-identifier\">buff</span>.<span class=\"ruby-identifier\">join</span>( <span class=\"ruby-value str\">&quot;\\n&quot;</span> )\n\
      24:     <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: ( indent_multiplier=1 )
  category: Instance
  type: Public
- methods: 
  - visibility: protected
    aref: M000019
    name: to_component_id
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/maps/support/base.rb, line 29</span>\n\
      29:       <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_component_id</span>\n\
      30:         <span class=\"ruby-identifier\">class_name</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>.<span class=\"ruby-identifier\">underscore</span>.<span class=\"ruby-identifier\">split</span>( <span class=\"ruby-value str\">&quot;/&quot;</span> ).<span class=\"ruby-identifier\">last</span>\n\
      31:       <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      converts class name to underscore name
      </p>
    params: ()
  category: Instance
  type: Protected

sectitle

--- 

[Validate]

Generated with the Darkfish Rdoc Generator.