class Focuslight::SimpleGraph
Constants
- COLUMNS
- PLACEHOLDERS
Attributes
adjust[RW]
adjustval[RW]
color[RW]
llimit[RW]
md5[R]
mode[RW]
type[RW]
ulimit[RW]
unit[RW]
Public Class Methods
meta_clean(args={})
click to toggle source
# File lib/focuslight/graph.rb, line 160 def self.meta_clean(args={}) args.delete_if do |k,v| %w(id service_name section_name graph_name number description sort mode color ulimit llimit type).include?(k.to_s) end end
new(row)
click to toggle source
Calls superclass method
Focuslight::Graph::new
# File lib/focuslight/graph.rb, line 107 def initialize(row) super @mode = row[:mode] || 'gauge' # NOT NULL DEFAULT 'gauge' @color = row[:color] || '#00CC00' # NOT NULL DEFAULT '#00CC00' @ulimit = row[:ulimit] || 1000000000000000 # NOT NULL DEFAULT 1000000000000000 @llimit = row[:llimit] || 0 @type = row[:type] || 'AREA' @md5 = Digest::MD5.hexdigest(@id.to_s) @adjust = @parsed_meta.fetch(:adjust, '*') @adjustval = @parsed_meta.fetch(:adjustval, '1') @unit = @parsed_meta.fetch(:unit, '') end
Public Instance Methods
complex?()
click to toggle source
# File lib/focuslight/graph.rb, line 136 def complex? false end
to_hash()
click to toggle source
Calls superclass method
Focuslight::Graph#to_hash
# File lib/focuslight/graph.rb, line 123 def to_hash simple = { mode: @mode, color: @color, ulimit: @ulimit, llimit: @llimit, type: @type, adjust: @adjust, adjustval: @adjustval, unit: @unit, complex: false, md5: @md5, meta: @meta, } hash = super hash.merge(simple) end
update(args={})
click to toggle source
# File lib/focuslight/graph.rb, line 140 def update(args={}) meta = @parsed_meta.dup args.each do |k, v| case k.to_sym when :number then @number = v when :description then @description = v when :sort then @sort = v when :mode then @mode = v when :color then @color = v when :ulimit then @ulimit = v when :llimit then @llimit = v when :type then @type = v else meta[k.to_sym] = v end end @parsed_meta = self.class.meta_clean(@parsed_meta.merge(meta)) @meta = @parsed_meta.to_json end