lib/refining/file.rb
# Give the original filename with incremental number appended
#
# @author Joel Azemar
#
# @return [String] new file name
Give the original filename with incremental number appended
Give the original filename with incremental number appended
def filename
      r = Regexp.new(/(?<file_name>.*)-(?<num>[0-9]{1,2})\.csv/)
      if (m = r.match(file_path))
        "#{m[:file_name]}-#{m[:num].to_i + 1}.csv"
      else
        "#{::File.basename(file_path, '.*')}-1.csv"
      end
    end
def filename r = Regexp . new ( / (?<file_name>.*)-(?<num>[0-9]{1,2}) \. csv / ) if ( m = r . match ( file_path ) ) "#{m[:file_name]}-#{m[:num].to_i + 1}.csv" else "#{::File.basename(file_path, '.*')}-1.csv" end end
Give the original filename with incremental number appended
Give the original filename with incremental number appended
new file name
new file name
String
author
None