Class MCollective::Data::Result
In: lib/mcollective/data/result.rb
Parent: Object

Methods

[]   []=   include?   keys   method_missing   new  

Public Class methods

[Source]

    # File lib/mcollective/data/result.rb, line 9
 9:       def initialize
10:         @data = {}
11:       end

Public Instance methods

[Source]

    # File lib/mcollective/data/result.rb, line 17
17:       def [](key)
18:         @data[key.to_sym]
19:       end

[Source]

    # File lib/mcollective/data/result.rb, line 21
21:       def []=(key, val)
22:         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)
23: 
24:         @data[key.to_sym] = val
25:       end

[Source]

    # File lib/mcollective/data/result.rb, line 13
13:       def include?(key)
14:         @data.include?(key.to_sym)
15:       end

[Source]

    # File lib/mcollective/data/result.rb, line 27
27:       def keys
28:         @data.keys
29:       end

[Source]

    # File lib/mcollective/data/result.rb, line 31
31:       def method_missing(method, *args)
32:         key = method.to_sym
33: 
34:         raise NoMethodError, "undefined local variable or method `%s'" % key unless include?(key)
35: 
36:         @data[key]
37:       end

[Validate]