Sha256: 1a450bba1a089c5983aebb615fbfb21d6dd462f90ce63dc5adb02a4730c68f04

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

# encoding: utf-8
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)

require "abstract"
require "hashie/mash"
require "qrpc/general"
require "qrpc/protocol/abstract"

##
# General QRPC module.
#

module QRPC
    
    ##
    # Protocols helper module.
    # @since 0.9.0
    #
    
    module Protocol

        ##
        # Abstract protocol implementation.
        # @since 0.9.0
        #
        
        class Abstract
        
            ##
            # Abstract request implementation.
            # @sice 0.9.0
            #
            
            class Object
              
                ##
                # Holds the object options.
                # @return [Hashie::Mash]  options hash
                #
                
                attr_accessor :options
                @options
                
                ##
                # Constructor.
                #
                # @param [Hash] init  initial options
                # @abstract
                #
                
                def initialize(init = { })
                    @options = Hashie::Mash::new(init)
                    if self.instance_of? Object
                        not_implemented
                    end
                end
                
                ##
                # Assigns options to the object.
                # @param [Hash] options  hash with options
                # 
                
                def assign_options(options = { })
                    @options = @options.merge(options)
                end
                
                ##
                # Serializes object to the resultant form.
                #
                # @return [String]  serialized form
                # @abstract
                #
                
                def serialize
                    not_implemented
                end
                
            end
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qrpc-0.9.0 lib/qrpc/protocol/abstract/object.rb