Module: Cleaner::FileExtension

Defined in:
lib/cleaner/file_extension.rb

Overview

Provides helper methods for File object which is passed to conditions. With this module we can write file.name insted of File.basename(file)

Instance Method Summary collapse

Instance Method Details

#nameObject



6
7
8
# File 'lib/cleaner/file_extension.rb', line 6

def name
  File.basename(path)
end

#name_without_extObject



14
15
16
# File 'lib/cleaner/file_extension.rb', line 14

def name_without_ext
  name.chomp(File.extname(name))
end

#path_without_extObject



10
11
12
# File 'lib/cleaner/file_extension.rb', line 10

def path_without_ext
  File.join(File.dirname(path), name_without_ext)
end