Module: FilenameCleaner

Defined in:
lib/filename_cleaner/cli.rb,
lib/filename_cleaner/version.rb,
lib/filename_cleaner/filename_cleaner.rb

Defined Under Namespace

Classes: CLI

Constant Summary collapse

VERSION =
'0.3.4'
DOT =
'.'

Class Method Summary collapse

Class Method Details

.sanitize(name, sep_char = '.', have_extension = false) ⇒ String

Sanitize the any name with or without any extension

Parameters:

  • name (String)

    the input string

  • sep_char (String) (defaults to: '.')

    the separator char to be used

Returns:

  • (String)

    output string with special chars replaced withe specified string



9
10
11
12
13
14
15
# File 'lib/filename_cleaner/filename_cleaner.rb', line 9

def sanitize(name, sep_char = '.', have_extension = false)
  if have_extension
    sanitize_name_with_extension(name, sep_char)
  else
    sanitize_name_without_extension(name, sep_char)
  end
end