Class: SASL::Mechanism
- Inherits:
-
Object
- Object
- SASL::Mechanism
- Defined in:
- lib/sasl/base.rb
Overview
Common functions for mechanisms
Mechanisms implement handling of methods start and receive. They return: [message_name, content] or nil where message_name is either ‘auth’ or ‘response’ and content is either a string which may transmitted encoded as Base64 or nil.
Instance Attribute Summary collapse
-
#mechanism ⇒ Object
readonly
Returns the value of attribute mechanism.
-
#preferences ⇒ Object
readonly
Returns the value of attribute preferences.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(mechanism, preferences) ⇒ Mechanism
constructor
A new instance of Mechanism.
- #receive(message_name, content) ⇒ Object
- #start ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(mechanism, preferences) ⇒ Mechanism
Returns a new instance of Mechanism.
98 99 100 101 102 |
# File 'lib/sasl/base.rb', line 98 def initialize(mechanism, preferences) @mechanism = mechanism @preferences = preferences @state = nil end |
Instance Attribute Details
#mechanism ⇒ Object (readonly)
Returns the value of attribute mechanism.
95 96 97 |
# File 'lib/sasl/base.rb', line 95 def mechanism @mechanism end |
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
96 97 98 |
# File 'lib/sasl/base.rb', line 96 def preferences @preferences end |
Instance Method Details
#failure? ⇒ Boolean
107 108 109 |
# File 'lib/sasl/base.rb', line 107 def failure? @state == :failure end |
#receive(message_name, content) ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'lib/sasl/base.rb', line 116 def receive(, content) case when 'success' @state = :success when 'failure' @state = :failure end nil end |
#success? ⇒ Boolean
104 105 106 |
# File 'lib/sasl/base.rb', line 104 def success? @state == :success end |