Sha256: 69e014fe72938f2c97d13f997836658665fc5853112d3c4ef4f462d226fdbe54

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

=begin

    This file is part of the Arachni-RPC project and may be subject to
    redistribution and commercial restrictions. Please see the Arachni-RPC
    web site for more information on licensing and terms of use.

=end

module Toq

# Represents an RPC response.
#
# It's here only for formalization purposes, it's not actually sent over the wire.
#
# What is sent is a hash generated by {#prepare_for_tx} which is in the form of:
#
#    {
#        # result of the RPC call
#        'obj' => object
#    }
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class Response < Message

    # @return   [Object]
    #   Return object of the {Request#message}.
    attr_accessor :obj

    # @return   [Hash]
    #
    #       {
    #           "name" => "Trying to access non-existent object 'blah'.",
    #           "backtrace" => [
    #               [0] "/home/zapotek/workspace/arachni-rpc/lib/toq/server.rb:285:in `call'",
    #               [1] "/home/zapotek/workspace/arachni-rpc/lib/toq/server.rb:85:in `block in receive_object'",
    #           ],
    #           "type" => "InvalidObject"
    #       }
    #
    #   For all available exception types look at {Exceptions}.
    attr_accessor :exception

    def exception?
        !!exception
    end

    def async?
        !!@async
    end

    def async!
        @async = true
    end

    private

    def transmit?( attr )
        ![:@async].include?( attr )
    end

end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toq-0.0.3 lib/toq/response.rb
toq-0.0.2 lib/toq/response.rb
toq-0.0.1 lib/toq/response.rb