Class: PostgresPR::Authentification

Inherits:
Message
  • Object
show all
Defined in:
lib/postgres-pr/message.rb

Constant Summary collapse

AuthTypeMap =
{}

Constants inherited from Message

Message::MsgTypeMap

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

dump, #dump, read, register_message_type

Instance Attribute Details

#auth_typeObject (readonly)

Returns the value of attribute auth_type.



79
80
81
# File 'lib/postgres-pr/message.rb', line 79

def auth_type
  @auth_type
end

Class Method Details

.create(buffer) ⇒ Object



83
84
85
86
87
88
89
90
# File 'lib/postgres-pr/message.rb', line 83

def self.create(buffer)
  buffer.position = 5
  authtype = buffer.read_int32
  klass = AuthTypeMap.fetch(authtype, UnknownAuthType)
  obj = klass.allocate
  obj.parse(buffer)
  obj
end

.register_auth_type(type) ⇒ Object



92
93
94
# File 'lib/postgres-pr/message.rb', line 92

def self.register_auth_type(type)
  AuthTypeMap[type] = self
end

Instance Method Details

#parse(buffer) ⇒ Object



96
97
98
99
100
101
# File 'lib/postgres-pr/message.rb', line 96

def parse(buffer)
  super do
    @auth_type = buffer.read_int32 
    yield if block_given?
  end
end