Class: Leeloo::LocalFileSystemSecret
- Defined in:
- lib/leeloo/secret.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#pathname ⇒ Object
readonly
Returns the value of attribute pathname.
Attributes inherited from Secret
Instance Method Summary collapse
- #erase ⇒ Object
-
#initialize(pathname, name) ⇒ LocalFileSystemSecret
constructor
A new instance of LocalFileSystemSecret.
- #read ⇒ Object
- #write(phrase) ⇒ Object
Methods inherited from Secret
Constructor Details
#initialize(pathname, name) ⇒ LocalFileSystemSecret
Returns a new instance of LocalFileSystemSecret.
35 36 37 38 |
# File 'lib/leeloo/secret.rb', line 35 def initialize pathname, name super name @pathname = pathname end |
Instance Attribute Details
#pathname ⇒ Object (readonly)
Returns the value of attribute pathname.
33 34 35 |
# File 'lib/leeloo/secret.rb', line 33 def pathname @pathname end |
Instance Method Details
#erase ⇒ Object
49 50 51 |
# File 'lib/leeloo/secret.rb', line 49 def erase File.delete @pathname end |
#read ⇒ Object
40 41 42 |
# File 'lib/leeloo/secret.rb', line 40 def read File.read @pathname end |
#write(phrase) ⇒ Object
44 45 46 47 |
# File 'lib/leeloo/secret.rb', line 44 def write phrase FileUtils.mkdir_p File.dirname @pathname File.write @pathname, phrase end |