Class: OnePassword::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/one_password/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keychain, directory) ⇒ Profile

Returns a new instance of Profile.

Parameters:



8
9
10
11
12
# File 'lib/one_password/profile.rb', line 8

def initialize(keychain, directory)
  @keychain  = keychain
  @name      = File.basename(directory)
  @directory = Pathname(directory)
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory.



14
15
16
# File 'lib/one_password/profile.rb', line 14

def directory
  @directory
end

#encryption_keysObject

Returns the value of attribute encryption_keys.



14
15
16
# File 'lib/one_password/profile.rb', line 14

def encryption_keys
  @encryption_keys
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/one_password/profile.rb', line 14

def name
  @name
end

Instance Method Details

#allObject



21
22
23
24
# File 'lib/one_password/profile.rb', line 21

def all
  load_contents unless @all
  @all
end

#all_encryption_keysObject



31
32
33
34
# File 'lib/one_password/profile.rb', line 31

def all_encryption_keys
  load_encryption_keys unless @all_encryption_keys
  @all_encryption_keys
end

#contentsObject



16
17
18
19
# File 'lib/one_password/profile.rb', line 16

def contents
  load_contents unless @contents
  @contents
end

#encryption_keys_loaded?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/one_password/profile.rb', line 36

def encryption_keys_loaded?
  !!@encryption_keys
end

#passwordObject

Raises:



40
41
42
43
# File 'lib/one_password/profile.rb', line 40

def password
  raise NoPassword unless @password
  @password
end

#password=(password) ⇒ Object



45
46
47
# File 'lib/one_password/profile.rb', line 45

def password=(password)
  @password = password
end