Class: Textus::Infra::Store::FileStore

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/infra/store/file_store.rb

Instance Method Summary collapse

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

Returns:

  • (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