Class: Ambling::Data::Pie

Inherits:
BaseData show all
Defined in:
lib/ambling/data.rb

Overview

For an amchart pie chart

Instance Attribute Summary collapse

Attributes inherited from BaseData

#message

Instance Method Summary collapse

Methods inherited from Base

#tag_name, #to_xml

Constructor Details

#initialize(data = []) ⇒ Pie

Returns a new instance of Pie.



230
231
232
# File 'lib/ambling/data.rb', line 230

def initialize(data = [])
  self.slices = data
end

Instance Attribute Details

#slicesObject

Returns the value of attribute slices.



228
229
230
# File 'lib/ambling/data.rb', line 228

def slices
  @slices
end

Instance Method Details

#build_xml(builder) ⇒ Object



249
250
251
252
# File 'lib/ambling/data.rb', line 249

def build_xml(builder)
  @message.build_xml(builder) if !@message.nil?
  @slices.each {|s| s.build_xml(builder)}
end

#push(item) ⇒ Object Also known as: <<



239
240
241
242
243
244
245
# File 'lib/ambling/data.rb', line 239

def push(item)
  if item.is_a?(Slice)
    @slices << item
  else
    @slices << Slice.new(item)
  end
end