Class: MCollective::RPC::Result

### Home Classes Methods

### In Files

- lib/mcollective/rpc/result.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #each
- #to_json

### Included Modules

- Enumerable

### Files

- COPYING
- README
- Rakefile
- PLACEHOLDER
- PLACEHOLDER

### Class/Module Index

Quicksearch

- MCollective
- MCollective::Agent
- MCollective::Agents
- MCollective::Aggregate
- MCollective::Aggregate::Base
- MCollective::Aggregate::Result
- MCollective::Aggregate::Result::Base
- MCollective::Aggregate::Result::CollectionResult
- MCollective::Aggregate::Result::NumericResult
- MCollective::Application
- MCollective::Applications
- MCollective::Client
- MCollective::Config
- MCollective::Connector
- MCollective::Connector::Base
- MCollective::DDL
- MCollective::DDLValidationError
- MCollective::Data
- MCollective::Data::Base
- MCollective::Data::Result
- MCollective::Discovery
- MCollective::Facts
- MCollective::Facts::Base
- MCollective::Generators
- MCollective::Generators::AgentGenerator
- MCollective::Generators::Base
- MCollective::Generators::DataGenerator
- MCollective::InvalidRPCData
- MCollective::Log
- MCollective::Logger
- MCollective::Logger::Base
- MCollective::Logger::Console_logger
- MCollective::Logger::File_logger
- MCollective::Logger::Syslog_logger
- MCollective::Matcher
- MCollective::Matcher::Parser
- MCollective::Matcher::Scanner
- MCollective::Message
- MCollective::MissingRPCData
- MCollective::MsgDoesNotMatchRequestID
- MCollective::MsgTTLExpired
- MCollective::NotTargettedAtUs
- MCollective::Optionparser
- MCollective::PluginManager
- MCollective::PluginPackager
- MCollective::PluginPackager::AgentDefinition
- MCollective::PluginPackager::StandardDefinition
- MCollective::RPC
- MCollective::RPC::ActionRunner
- MCollective::RPC::Agent
- MCollective::RPC::Audit
- MCollective::RPC::Client
- MCollective::RPC::Helpers
- MCollective::RPC::Progress
- MCollective::RPC::Reply
- MCollective::RPC::Request
- MCollective::RPC::Result
- MCollective::RPC::Stats
- MCollective::RPCAborted
- MCollective::RPCError
- MCollective::Registration
- MCollective::Registration::Base
- MCollective::Runner
- MCollective::RunnerStats
- MCollective::SSL
- MCollective::Security
- MCollective::Security::Base
- MCollective::SecurityValidationFailed
- MCollective::Shell
- MCollective::UnixDaemon
- MCollective::UnknownRPCAction
- MCollective::UnknownRPCError
- MCollective::Util
- MCollective::WindowsDaemon
- Array
- Dir
- Object
- String
- Symbol

No matching classes.

# MCollective::RPC::Result

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

### Attributes

action[R]
agent[R]
results[R]

### Public Instance Methods

[](idx) click to toggle source

    # File lib/mcollective/rpc/result.rb, line 19
    def [](idx)
      @results[idx]
    end

[]=(idx, item) click to toggle source

    # File lib/mcollective/rpc/result.rb, line 23
    def []=(idx, item)
      @results[idx] = item
    end

each() click to toggle source

    # File lib/mcollective/rpc/result.rb, line 27
    def each
      @results.each_pair {|k,v| yield(k,v) }
    end

to_json(*a) click to toggle source

    # File lib/mcollective/rpc/result.rb, line 31
    def to_json(*a)
      {:agent => @agent,
       :action => @action,
       :sender => @results[:sender],
       :statuscode => @results[:statuscode],
       :statusmsg => @results[:statusmsg],
       :data => @results[:data]}.to_json(*a)
    end

### Public Class Methods

new(agent, action, result={}) click to toggle source

    # File lib/mcollective/rpc/result.rb, line 13
    def initialize(agent, action, result={})
      @agent = agent
      @action = action
      @results = result
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.