Module: JunglePath::File
- Defined in:
- lib/jungle_path/file/file.rb
Class Method Summary collapse
Class Method Details
.add_timestamp_to_file_name(file_name, post_fix = true) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jungle_path/file/file.rb', line 5 def self. file_name, post_fix=true stamp = JunglePath::Time. path_parts = file_name.split('/') parts = path_parts[-1].split('.') if post_fix parts[0] = "#{parts[0]}_#{stamp}" else parts[0] = "#{stamp}_#{parts[0]}" end path_parts[-1] = parts.join('.') path_parts.join('/') end |