Class: Ambling::Data::XyGraph

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

Overview

xy graphs contain points, not values I know I should abstract the BaseValueHolder to handle a generic array of Values. Unfortunately, I don’t have time right now

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = []) ⇒ XyGraph

Returns a new instance of XyGraph.



129
130
131
# File 'lib/ambling/data.rb', line 129

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

Instance Attribute Details

#pointsObject

Returns the value of attribute points.



127
128
129
# File 'lib/ambling/data.rb', line 127

def points
  @points
end

Instance Method Details

#build_xml(builder) ⇒ Object



148
149
150
# File 'lib/ambling/data.rb', line 148

def build_xml(builder)
  @points.each { |point| point.build_xml(builder) }
end

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



138
139
140
141
142
143
144
# File 'lib/ambling/data.rb', line 138

def push(item)
  if item.is_a?(Point)
    @points << item
  else
    @points << Point.new(item)
  end
end