Class: Tumugi::FileSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/tumugi/file_system.rb

Overview

This class defines interfaces of file system such as local file, Amazon S3, Google Cloud Storage

Instance Method Summary collapse

Instance Method Details

#directory?(path) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/tumugi/file_system.rb', line 20

def directory?(path)
  raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end

#entries(path) ⇒ Object

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/tumugi/file_system.rb', line 24

def entries(path)
  raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end

#exist?(path) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/tumugi/file_system.rb', line 8

def exist?(path)
  raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end

#mkdir(path, parents: true, raise_if_exist: false) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/tumugi/file_system.rb', line 16

def mkdir(path, parents: true, raise_if_exist: false)
  raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end

#move(src, dest, raise_if_exist: false) ⇒ Object

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/tumugi/file_system.rb', line 28

def move(src, dest, raise_if_exist: false)
  raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end

#remove(path, recursive: true) ⇒ Object

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/tumugi/file_system.rb', line 12

def remove(path, recursive: true)
  raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end

#rename(path, dest) ⇒ Object



32
33
34
35
36
# File 'lib/tumugi/file_system.rb', line 32

def rename(path, dest)
  Tumugi::Logger.instance.warn "File system #{self.class.name} client doesn't support atomic move."
  raise FileAlreadyExistError if exist?(dest)
  move(path, dest)
end