Class: QRPC::Protocol::Abstract::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/qrpc/protocol/abstract/object.rb

Overview

Abstract request implementation.

Since:

  • 0.9.0

Direct Known Subclasses

Request, Response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(init = { }) ⇒ Object

This method is abstract.

Constructor.

Parameters:

  • init (Hash) (defaults to: { })

    initial options

Since:

  • 0.9.0



51
52
53
54
55
56
# File 'lib/qrpc/protocol/abstract/object.rb', line 51

def initialize(init = { })
    @options = Hashie::Mash::new(init)
    if self.instance_of? Object
        not_implemented
    end
end

Instance Attribute Details

#optionsHashie::Mash

Holds the object options.

Returns:

  • (Hashie::Mash)

    options hash

Since:

  • 0.9.0



41
42
43
# File 'lib/qrpc/protocol/abstract/object.rb', line 41

def options
  @options
end

Instance Method Details

#assign_options(options = { }) ⇒ Object

Assigns options to the object.

Parameters:

  • options (Hash) (defaults to: { })

    hash with options

Since:

  • 0.9.0



63
64
65
# File 'lib/qrpc/protocol/abstract/object.rb', line 63

def assign_options(options = { })
    @options = @options.merge(options)
end

#serializeString

This method is abstract.

Serializes object to the resultant form.

Returns:

  • (String)

    serialized form

Since:

  • 0.9.0



74
75
76
# File 'lib/qrpc/protocol/abstract/object.rb', line 74

def serialize
    not_implemented
end