class PRRD::Graph::Area
Public Class Methods
new(values = nil)
click to toggle source
Constructor
Calls superclass method
PRRD::Entity::new
# File lib/prrd/graph/area.rb, line 11 def initialize(values = nil) @keys = [ :value, :color, :legend, :stack ] super values end
Public Instance Methods
to_s()
click to toggle source
Transform to a AREA formatted string
# File lib/prrd/graph/area.rb, line 23 def to_s fail 'Empty area object' if @data.empty? validate_presence :value chunks = [] @keys.each do |k| next unless @data.key?(k) case k when :value chunks << "AREA:%s%s" % [@data[k], @data[:color]] when :legend chunks << "\"%s\"" % @data[k] when :stack chunks << "STACK" when :color # nope else chunks << @data[k] end end chunks.join ':' end