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.
94 95 96 97 98 |
# File 'lib/sasl/base.rb', line 94 def initialize(mechanism, preferences) @mechanism = mechanism @preferences = preferences @state = nil end |
Instance Attribute Details
#mechanism ⇒ Object (readonly)
Returns the value of attribute mechanism.
91 92 93 |
# File 'lib/sasl/base.rb', line 91 def mechanism @mechanism end |
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
92 93 94 |
# File 'lib/sasl/base.rb', line 92 def preferences @preferences end |
Instance Method Details
#failure? ⇒ Boolean
103 104 105 |
# File 'lib/sasl/base.rb', line 103 def failure? @state == :failure end |
#receive(message_name, content) ⇒ Object
112 113 114 115 116 117 118 119 120 |
# File 'lib/sasl/base.rb', line 112 def receive(, content) case when 'success' @state = :success when 'failure' @state = :failure end nil end |
#success? ⇒ Boolean
100 101 102 |
# File 'lib/sasl/base.rb', line 100 def success? @state == :success end |