Class: Hiiro::Effects::Filesystem

Inherits:
Object
  • Object
show all
Defined in:
lib/hiiro/effects.rb

Overview

Real filesystem implementation.

Instance Method Summary collapse

Instance Method Details

#exist?(path) ⇒ Boolean

Returns:

  • (Boolean)


86
# File 'lib/hiiro/effects.rb', line 86

def exist?(path)      = File.exist?(path)

#glob(pattern) ⇒ Object



88
# File 'lib/hiiro/effects.rb', line 88

def glob(pattern)     = Dir.glob(pattern)

#mkdir_p(path) ⇒ Object



87
# File 'lib/hiiro/effects.rb', line 87

def mkdir_p(path)     = FileUtils.mkdir_p(path)

#mv(src, dst) ⇒ Object



90
# File 'lib/hiiro/effects.rb', line 90

def mv(src, dst)      = FileUtils.mv(src, dst)

#read(path) ⇒ Object



85
# File 'lib/hiiro/effects.rb', line 85

def read(path)        = File.read(path)

#rename(src, dst) ⇒ Object



91
# File 'lib/hiiro/effects.rb', line 91

def rename(src, dst)  = File.rename(src, dst)

#rm(path) ⇒ Object



89
# File 'lib/hiiro/effects.rb', line 89

def rm(path)          = File.exist?(path) ? File.delete(path) : nil

#write(path, content) ⇒ Object



80
81
82
83
# File 'lib/hiiro/effects.rb', line 80

def write(path, content)
  FileUtils.mkdir_p(File.dirname(path))
  File.write(path, content)
end