Sha256: a9b89ba26f7c5b410f20cc8927beda742f48c4d63a48d92f5f1076dc46410980
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 Bytes
Contents
module MCollective module RPC # Simple class to manage compliant results from MCollective::RPC agents # # Currently it just fakes Hash behaviour to the result to remain backward # compatible but it also knows which agent and action produced it so you # can associate results to a DDL class Result attr_reader :agent, :action, :results include Enumerable def initialize(agent, action, result={}) @agent = agent @action = action @results = result end def [](idx) @results[idx] end def []=(idx, item) @results[idx] = item end def each @results.each_pair {|k,v| yield(k,v) } end def to_json(*a) {:agent => @agent, :action => @action, :sender => @results[:sender], :statuscode => @results[:statuscode], :statusmsg => @results[:statusmsg], :data => @results[:data]}.to_json(*a) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mcollective-client-2.0.0 | lib/mcollective/rpc/result.rb |
mcollective-client-1.3.3 | lib/mcollective/rpc/result.rb |