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