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.
116 117 118 119 120 |
# File 'lib/sasl/base.rb', line 116 def initialize(mechanism, preferences) @mechanism = mechanism @preferences = preferences @state = nil end |
Instance Attribute Details
#mechanism ⇒ Object (readonly)
Returns the value of attribute mechanism.
113 114 115 |
# File 'lib/sasl/base.rb', line 113 def mechanism @mechanism end |
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
114 115 116 |
# File 'lib/sasl/base.rb', line 114 def preferences @preferences end |
Instance Method Details
#failure? ⇒ Boolean
125 126 127 |
# File 'lib/sasl/base.rb', line 125 def failure? @state == :failure end |
#receive(message_name, content) ⇒ Object
134 135 136 137 138 139 140 141 142 |
# File 'lib/sasl/base.rb', line 134 def receive(, content) case when 'success' @state = :success when 'failure' @state = :failure end nil end |
#success? ⇒ Boolean
122 123 124 |
# File 'lib/sasl/base.rb', line 122 def success? @state == :success end |