Module: CKick::PathDelegate

Defined in:
lib/ckick/path_delegate.rb

Class Method Summary collapse

Class Method Details

.create_directory(dirpath) ⇒ Object



11
12
13
# File 'lib/ckick/path_delegate.rb', line 11

def self.create_directory(dirpath)
  FileUtils.mkdir_p(dirpath)
end

.touch_file(filepath) ⇒ Object



23
24
25
# File 'lib/ckick/path_delegate.rb', line 23

def self.touch_file(filepath)
  FileUtils.touch(filepath)
end

.write_file(dirpath, filename, content) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/ckick/path_delegate.rb', line 15

def self.write_file(dirpath, filename, content)
  raise BadFileContentError, "content does not respond to to_s" unless content.respond_to?(:to_s)
  filepath = File.join(dirpath, filename)
  file = File.new(filepath, "w")
  file << content.to_s
  file.close
end