Class: Keyring::Backend
- Inherits:
-
Object
- Object
- Keyring::Backend
- Defined in:
- lib/keyring/backend.rb
Overview
keyring: System keyring abstraction library License: MIT (www.opensource.org/licenses/mit-license.php)
Direct Known Subclasses
Defined Under Namespace
Classes: GnomeKeyring, MacosxKeychain, Memory
Class Attribute Summary collapse
-
.implementations ⇒ Object
Returns the value of attribute implementations.
Class Method Summary collapse
Instance Method Summary collapse
- #delete_password(service, username) ⇒ Object
- #get_password(service, username) ⇒ Object
-
#priority ⇒ Object
Returns a number between 0 and 1 (inclusive) indicating the relative preference for this backend.
- #set_password(service, username, password) ⇒ Object
-
#supported? ⇒ Boolean
Backend classes must implement these methods.
Class Attribute Details
.implementations ⇒ Object
Returns the value of attribute implementations.
7 8 9 |
# File 'lib/keyring/backend.rb', line 7 def implementations @implementations end |
Class Method Details
.create ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/keyring/backend.rb', line 13 def self.create supported = implementations.collect{|i| b = i.new; b.supported? ? b : nil}.compact if supported.empty? raise(NotImplementedError) end supported.max{|a, b| a.priority <=> b.priority } end |
.register_implementation(impl) ⇒ Object
9 10 11 |
# File 'lib/keyring/backend.rb', line 9 def self.register_implementation(impl) Keyring::Backend.implementations << impl end |
Instance Method Details
#delete_password(service, username) ⇒ Object
39 40 41 |
# File 'lib/keyring/backend.rb', line 39 def delete_password(service, username) raise NotImplementedError end |
#get_password(service, username) ⇒ Object
36 37 38 |
# File 'lib/keyring/backend.rb', line 36 def get_password(service, username) raise NotImplementedError end |
#priority ⇒ Object
Returns a number between 0 and 1 (inclusive) indicating the relative preference for this backend.
30 31 32 |
# File 'lib/keyring/backend.rb', line 30 def priority 0 end |
#set_password(service, username, password) ⇒ Object
33 34 35 |
# File 'lib/keyring/backend.rb', line 33 def set_password(service, username, password) raise NotImplementedError end |
#supported? ⇒ Boolean
Backend classes must implement these methods
25 26 27 |
# File 'lib/keyring/backend.rb', line 25 def supported? false end |