Parent

Arachni::RPC::Message

Represents an RPC message, serves as the basis for {Request} and {Response}.

@author: Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>

Public Class Methods

new( opts = {} ) click to toggle source

@param [Hash] opts sets instance attributes

# File lib/arachni/rpc/message.rb, line 22
def initialize( opts = {} )
    opts.each_pair { |k, v| instance_variable_set( "@#{k}".to_sym, v ) }
end

Public Instance Methods

merge!( message ) click to toggle source

Merges the attributes of another message with self.

(The param doesn't really have to be a message, any object will do.)

@param [Message] message

# File lib/arachni/rpc/message.rb, line 33
def merge!( message )
    message.instance_variables.each do |var|
        val = message.instance_variable_get( var )
        instance_variable_set( var, val )
    end
end
prepare_for_tx() click to toggle source

Prepares the message for transmission (i.e. converts the message to a Hash).

Attributes that should not be included can be skipped by implementing {transmit?} and returning the appropriate value.

@return [Hash]

# File lib/arachni/rpc/message.rb, line 48
def prepare_for_tx
    instance_variables.inject({}) do |h, k|
        h[normalize( k )] = instance_variable_get( k ) if transmit?( k )
        h
    end
end
transmit?( attr ) click to toggle source

Decides which attributes should be skipped by {prepare_for_tx}.

@param [Symbol] attr attribute symbol (i.e. :@token)

# File lib/arachni/rpc/message.rb, line 60
def transmit?( attr )
    true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.