Class: OnePassword::Keychain
- Inherits:
-
Object
- Object
- OnePassword::Keychain
- Defined in:
- lib/one_password/keychain.rb
Instance Method Summary collapse
- #current_profile ⇒ Profile
- #current_profile=(profile) ⇒ Object
-
#initialize(directory = '~/Dropbox/1Password.agilekeychain') ⇒ Keychain
constructor
A new instance of Keychain.
- #password=(password) ⇒ Object
Constructor Details
#initialize(directory = '~/Dropbox/1Password.agilekeychain') ⇒ Keychain
Returns a new instance of Keychain.
9 10 11 12 13 |
# File 'lib/one_password/keychain.rb', line 9 def initialize(directory = '~/Dropbox/1Password.agilekeychain') @directory = Pathname(File.(directory)) @master_password = nil profiles end |
Instance Method Details
#current_profile ⇒ Profile
16 17 18 |
# File 'lib/one_password/keychain.rb', line 16 def current_profile @current_profile ||= profiles['default'] end |
#current_profile=(profile) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/one_password/keychain.rb', line 21 def current_profile=(profile) unless profile.is_a?(Profile) raise UndefinedProfile.new(profile) unless profiles.key?(profile) profile = profiles[profile] end @profile = profile end |
#password=(password) ⇒ Object
29 30 31 |
# File 'lib/one_password/keychain.rb', line 29 def password=(password) current_profile.password = password end |