Parent

Class/Module Index [+]

Quicksearch

MCollective::Data::Result

Public Class Methods

new(outputs) click to toggle source
# File lib/mcollective/data/result.rb, line 9
def initialize(outputs)
  @data = {}

  outputs.keys.each do |output|
    @data[output] = Marshal.load(Marshal.dump(outputs[output].fetch(:default, nil)))
  end
end

Public Instance Methods

[](key) click to toggle source
# File lib/mcollective/data/result.rb, line 21
def [](key)
  @data[key.to_sym]
end
[]=(key, val) click to toggle source
# File lib/mcollective/data/result.rb, line 25
def []=(key, val)
  raise "Can only store String, Integer, Float or Boolean data but got #{val.class} for key #{key}" unless [String, Fixnum, Bignum, Float, TrueClass, FalseClass].include?(val.class)

  @data[key.to_sym] = val
end
include?(key) click to toggle source
# File lib/mcollective/data/result.rb, line 17
def include?(key)
  @data.include?(key.to_sym)
end
keys() click to toggle source
# File lib/mcollective/data/result.rb, line 31
def keys
  @data.keys
end
method_missing(method, *args) click to toggle source
# File lib/mcollective/data/result.rb, line 35
def method_missing(method, *args)
  key = method.to_sym

  raise NoMethodError, "undefined local variable or method `%s'" % key unless include?(key)

  @data[key]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.