Class: Ambling::Data::BaseValueHolder

Inherits:
Base
  • Object
show all
Defined in:
lib/ambling/data.rb

Overview

Holds an array of values

Direct Known Subclasses

LineColumnGraph, Series

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#tag_name, #to_xml

Constructor Details

#initialize(data = [], attributes = {}) ⇒ BaseValueHolder

Returns a new instance of BaseValueHolder.



79
80
81
82
# File 'lib/ambling/data.rb', line 79

def initialize(data = [], attributes = {})
  self.values = data
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



77
78
79
# File 'lib/ambling/data.rb', line 77

def attributes
  @attributes
end

#valuesObject

Returns the value of attribute values.



77
78
79
# File 'lib/ambling/data.rb', line 77

def values
  @values
end

Instance Method Details

#build_xml(builder) ⇒ Object



99
100
101
# File 'lib/ambling/data.rb', line 99

def build_xml(builder)
  @values.each { |value| value.build_xml(builder) }
end

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



89
90
91
92
93
94
95
# File 'lib/ambling/data.rb', line 89

def push(item)
  if item.is_a?(Value)
    @values << item
  else
    @values << Value.new(item, {:xid => @values.size+1})
  end
end