Class: Leeloo::GpgLocalFileSystemSecret
- Inherits:
-
LocalFileSystemSecret
- Object
- Secret
- LocalFileSystemSecret
- Leeloo::GpgLocalFileSystemSecret
- Defined in:
- lib/leeloo/secret.rb
Instance Attribute Summary
Attributes inherited from LocalFileSystemSecret
Attributes inherited from Secret
Instance Method Summary collapse
-
#initialize(pathname, name, recipients) ⇒ GpgLocalFileSystemSecret
constructor
A new instance of GpgLocalFileSystemSecret.
- #read ⇒ Object
- #write(phrase) ⇒ Object
Methods inherited from LocalFileSystemSecret
Methods inherited from Secret
Constructor Details
#initialize(pathname, name, recipients) ⇒ GpgLocalFileSystemSecret
Returns a new instance of GpgLocalFileSystemSecret.
68 69 70 71 72 |
# File 'lib/leeloo/secret.rb', line 68 def initialize pathname, name, recipients super pathname, name @recipients = recipients @crypto = GPGME::Crypto.new :always_trust => true end |
Instance Method Details
#read ⇒ Object
74 75 76 |
# File 'lib/leeloo/secret.rb', line 74 def read @crypto.decrypt File.open(@pathname) end |
#write(phrase) ⇒ Object
78 79 80 81 82 83 |
# File 'lib/leeloo/secret.rb', line 78 def write phrase FileUtils.mkdir_p File.dirname @pathname @crypto.encrypt phrase, :output => File.open(@pathname,"w+"), :recipients => @recipients end |