Module: Eco::Data::Files::ClassMethods

Includes:
Encoding, Folder, RelativePath, Timestamp
Included in:
Eco::Data::Files
Defined in:
lib/eco/data/files.rb

Constant Summary

Constants included from Timestamp

Timestamp::DEFAULT_TIMESTAMP

Constants included from Folder

Folder::PRESERVED_FILES

Constants included from Encoding

Encoding::BOM_BYTES

Instance Attribute Summary

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

Methods included from RelativePath

#to_relative_path

Methods included from Timestamp

#timestamp, #timestamp_file

Methods included from Folder

#archive_file, #clear_folder, #csv_files, #ensure_file_path!, #ensure_folder!, #folder_files

Methods included from Language::AuxiliarLogger

#log

Methods included from Encoding

#bom?, #encoding, #get_file_content_with_encoding, #remove_bom, #scoped_encoding

Instance Method Details

#copy_file(source_file, dest_file, time_stamp: false) ⇒ Object



40
41
42
43
# File 'lib/eco/data/files.rb', line 40

def copy_file(source_file, dest_file, time_stamp: false)
  dest_file = timestamp_file(dest_file) if time_stamp
  File.write(dest_file, File.read(source_file))
end

#split(path) ⇒ Object

@todo: change method name to split_path



34
35
36
37
38
# File 'lib/eco/data/files.rb', line 34

def split(path)
  dir_path, file = File.split(path)
  dir_path       = dir_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
  dir_path.split(File::ALT_SEPARATOR || File::SEPARATOR).push(file)
end