Class: Keyrack::Store::Filesystem
- Inherits:
-
Object
- Object
- Keyrack::Store::Filesystem
- Defined in:
- lib/keyrack/store/filesystem.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Filesystem
constructor
A new instance of Filesystem.
- #read ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(options) ⇒ Filesystem
Returns a new instance of Filesystem.
4 5 6 |
# File 'lib/keyrack/store/filesystem.rb', line 4 def initialize() @path = File.(['path']) end |
Instance Method Details
#read ⇒ Object
8 9 10 |
# File 'lib/keyrack/store/filesystem.rb', line 8 def read File.exist?(@path) ? File.read(@path) : nil end |
#write(data) ⇒ Object
12 13 14 |
# File 'lib/keyrack/store/filesystem.rb', line 12 def write(data) File.open(@path, 'w') { |f| f.write(data) } end |