class PostgresPR::Authentication

Constants

AuthTypeMap

Public Class Methods

create(buffer) click to toggle source
# File lib/postgres-pr/message.rb, line 117
def self.create(buffer)
  authtype = buffer.get_int32_network(5)
  klass = AuthTypeMap[authtype]
  obj = klass.allocate
  obj.init_buffer buffer
  obj.parse(obj)
  obj
end
register_auth_type(type) click to toggle source
# File lib/postgres-pr/message.rb, line 126
def self.register_auth_type(type)
  raise(PGError, "duplicate auth type registration") if AuthTypeMap.has_key?(type)
  AuthTypeMap[type] = self
  self.const_set(:AuthType, type) 
  class_eval "def auth_type() AuthType end"
end

Public Instance Methods

dump() click to toggle source
Calls superclass method PostgresPR::Message::dump
# File lib/postgres-pr/message.rb, line 136
def dump
  super(4) do |buffer|
    buffer.write_int32_network(self.auth_type)
  end
end
Also aliased as: message__dump
message__dump()

the dump method of class Message

Alias for: dump
parse(buffer) { || ... } click to toggle source
Calls superclass method PostgresPR::Message#parse
# File lib/postgres-pr/message.rb, line 142
def parse(buffer)
  super do
    auth_t = buffer.read_int32_network 
    raise ParseError unless auth_t == self.auth_type
    yield if block_given?
  end
end