Class: Keyrack::Store::Filesystem

Inherits:
Object
  • Object
show all
Defined in:
lib/keyrack/store/filesystem.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Filesystem

Returns a new instance of Filesystem.



4
5
6
# File 'lib/keyrack/store/filesystem.rb', line 4

def initialize(options)
  @path = File.expand_path(options['path'])
end

Instance Method Details

#readObject



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