Module: CemAcpt::Utils::Files
- Defined in:
- lib/cem_acpt/utils/files.rb
Overview
Utility classes and methods for files
Defined Under Namespace
Classes: FileUtil, JsonUtil, YamlUtil
Class Method Summary collapse
- .delete(file, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) ⇒ Object
-
.read(file, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) ⇒ Object
Reads a file based on its extension.
- .write(file, content, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) ⇒ Object
Class Method Details
.delete(file, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) ⇒ Object
31 32 33 |
# File 'lib/cem_acpt/utils/files.rb', line 31 def delete(file, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) new_file_util_for(file, log_level: log_level, log_prefix: log_prefix).delete(file, *args, **kwargs) end |
.read(file, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) ⇒ Object
Reads a file based on its extension
19 20 21 22 23 24 25 |
# File 'lib/cem_acpt/utils/files.rb', line 19 def read(file, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) return from_content_registry(file, :content) unless file_changed?(file) content = new_file_util_for(file, log_level: log_level, log_prefix: log_prefix).read(file, *args, **kwargs) add_to_content_registry(file, :content, content) content end |
.write(file, content, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) ⇒ Object
27 28 29 |
# File 'lib/cem_acpt/utils/files.rb', line 27 def write(file, content, *args, log_level: :debug, log_prefix: 'CemAcpt', **kwargs) new_file_util_for(file, log_level: log_level, log_prefix: log_prefix).write(file, content, *args, **kwargs) end |