Class: Gsasl::RemoteAuthenticator
- Inherits:
-
Object
- Object
- Gsasl::RemoteAuthenticator
- Defined in:
- lib/gsasl/remote_authenticator.rb
Overview
This class handles remote authentication sessions that are based on a socket like interaction mechanism. This class will most of the time not be used directly but through helper methods (See Peer#authenticate_with).
Instance Method Summary collapse
-
#initialize ⇒ RemoteAuthenticator
constructor
A new instance of RemoteAuthenticator.
-
#receive { ... } ⇒ Object
This defines or calls the recieve callback.
-
#send(data = nil) {|data| ... } ⇒ Object
This defines or calls the send callback.
Constructor Details
#initialize ⇒ RemoteAuthenticator
Returns a new instance of RemoteAuthenticator.
6 7 8 9 |
# File 'lib/gsasl/remote_authenticator.rb', line 6 def initialize @receive_callback = nil @send_callback = nil end |
Instance Method Details
#receive { ... } ⇒ Object
This defines or calls the recieve callback. It will be defined, if a block is given, otherwise the callback is going to be called.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gsasl/remote_authenticator.rb', line 17 def receive(&block) if block_given? # define the callback @receive_callback = block elsif @receive_callback @receive_callback.call else raise GsaslError, "The receive callback is not defined!" end end |
#send(data = nil) {|data| ... } ⇒ Object
This defines or calls the send callback. It will be defined, if a block is given, otherwise the callback is going to be called.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gsasl/remote_authenticator.rb', line 33 def send(data = nil, &block) if block_given? # define the callback @send_callback = block elsif @send_callback @send_callback.call(data) else raise GsaslError, "The send callback is not defined!" end end |