Class: Textus::Infra::Store::FileStore
- Inherits:
-
Object
- Object
- Textus::Infra::Store::FileStore
- Defined in:
- lib/textus/infra/store/file_store.rb
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #etag(path) ⇒ Object
- #exists?(path) ⇒ Boolean
-
#initialize(file_system) ⇒ FileStore
constructor
A new instance of FileStore.
- #move(from, to) ⇒ Object
- #read(path) ⇒ Object
- #write(path, bytes) ⇒ Object
Constructor Details
#initialize(file_system) ⇒ FileStore
Returns a new instance of FileStore.
5 6 7 |
# File 'lib/textus/infra/store/file_store.rb', line 5 def initialize(file_system) @fs = file_system end |
Instance Method Details
#delete(path) ⇒ Object
16 |
# File 'lib/textus/infra/store/file_store.rb', line 16 def delete(path) = @fs.delete(path) |
#etag(path) ⇒ Object
19 |
# File 'lib/textus/infra/store/file_store.rb', line 19 def etag(path) = Textus::Value::Etag.for_file(path) |
#exists?(path) ⇒ Boolean
18 |
# File 'lib/textus/infra/store/file_store.rb', line 18 def exists?(path) = @fs.exists?(path) |
#move(from, to) ⇒ Object
17 |
# File 'lib/textus/infra/store/file_store.rb', line 17 def move(from, to) = @fs.mv(from, to) |
#read(path) ⇒ Object
9 |
# File 'lib/textus/infra/store/file_store.rb', line 9 def read(path) = @fs.read(path) |
#write(path, bytes) ⇒ Object
11 12 13 14 |
# File 'lib/textus/infra/store/file_store.rb', line 11 def write(path, bytes) @fs.mkdir_p(File.dirname(path)) @fs.write(path, bytes) end |