class Statusboard::DSL::GraphDescription

Public Instance Methods

construct() click to toggle source
# File lib/statusboard/dsl/dsl.rb, line 69
def construct
        constructed = {
                "graph" => {
                        "title"                           => @title,
                        "refreshEveryNSeconds"    => @refresh_interval,
                        "totals"                          => @display_totals,
                        "type"                                    => @type
                }
        }

        begin
                data = GraphData.new(&@data)
                constructed["graph"]["datasequences"] = data.construct
        rescue DataSourceError => e
                constructed["graph"]["error"] = {
                        "message" => e.message,
                        "detail" => e.message
                }
        end

        constructed["graph"]["xAxis"] = @x_axis.construct unless @x_axis.nil?
        constructed["graph"]["yAxis"] = @y_axis.construct unless @y_axis.nil?
        
        constructed
end
data(proc = nil, &block) click to toggle source
# File lib/statusboard/dsl/dsl.rb, line 57
def data(proc = nil, &block)
        @data = if proc.nil? then block else proc end
end
x_axis(&block) click to toggle source
# File lib/statusboard/dsl/dsl.rb, line 61
def x_axis(&block)
        @x_axis = XAxis.new(&block)
end
y_axis(&block) click to toggle source
# File lib/statusboard/dsl/dsl.rb, line 65
def y_axis(&block)
        @y_axis = YAxis.new(&block)
end