module RRD

Constants

BANG_METHODS

Public Instance Methods

bang(method, *args, &block) click to toggle source
# File lib/rrd.rb, line 54
def bang(method, *args, &block)
  result = send(method, *args, &block)
  raise error unless result
  result
end
error() click to toggle source
# File lib/rrd.rb, line 27
def error
  Wrapper.error
end
graph(image_file, options = {}, &block) click to toggle source
# File lib/rrd.rb, line 15
def graph(image_file, options = {}, &block)
  graph = Graph.new(image_file, options)
  graph.instance_eval(&block)
  graph.save
end
methods() click to toggle source
Calls superclass method
# File lib/rrd.rb, line 50
def methods
  super + BANG_METHODS
end
to_line_parameters(hash, known_flags = []) click to toggle source
# File lib/rrd.rb, line 31
def to_line_parameters(hash, known_flags = [])
  used_flags = []
  known_flags.each do |flag|
    used_flags << "--#{flag}".gsub(/_/, "-") if hash.delete(flag)
  end

  line_params = []

  hash.each_pair do |key,value|
    if value.kind_of? Array
      value.each {|v| line_params += ["--#{key}".gsub(/_/, "-"), v.to_s]}
    else
      line_params += ["--#{key}".gsub(/_/, "-"), value.to_s]
    end
  end

  used_flags + line_params
end
xport(options = {}, &block) click to toggle source
# File lib/rrd.rb, line 21
def xport(options = {}, &block)
  xport = Xport.new(options)
  xport.instance_eval(&block)
  xport.save
end