Class: Ziya::Components::SeriesExplode

Inherits:
Base
  • Object
show all
Defined in:
lib/ziya/components/series_explode.rb

Instance Method Summary collapse

Methods inherited from Base

#==, attributes, #attributes_for, #configured?, has_attribute, #has_sub_components, #initialize, #merge, #options, #options_as_string

Methods included from Utils::Text

#camelize, #classify, #demodulize, #underscore

Constructor Details

This class inherits a constructor from Ziya::Components::Base

Instance Method Details

#flatten(xml) ⇒ Object


Dump has_attribute into xml element



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ziya/components/series_explode.rb', line 23

def flatten( xml )
  if numbers
    xml.series_explode do
      if numbers.is_a? String
        nums = numbers.split( "," )
        nums.each { |n| xml.number( n.strip ) }
      elsif numbers.respond_to? :each
        numbers.each { |n| xml.number( n ) }
      else
        xml.number( numbers )
      end
    end   
  end
end