Top Level Namespace

Defined Under Namespace

Modules: Can, Error, Trashinfo

Constant Summary collapse

EXIT_SUCCESS =
0
EXIT_FAILURE =
1
Version =

This needs to be here because OptParse only looks at Version and @version for the version number, not VERSION. Putting it in the namespace of Can or ArgParse breaks it. Annoying.

Can::VERSION

Instance Method Summary collapse

Instance Method Details

#gather_extensions(filename) ⇒ Object

Returns all extensions of a filename



13
14
15
16
17
18
19
20
21
# File 'lib/trash.rb', line 13

def gather_extensions(filename)
  exts = ''
  while not File.extname(filename).empty?
    ext = File.extname(filename)
    exts = ext + exts
    filename = File.basename(filename, ext)
  end
  exts
end

#strip_extensions(filename) ⇒ Object

Returns filename with all trailing extensions removed



4
5
6
7
8
9
10
# File 'lib/trash.rb', line 4

def strip_extensions(filename)
  ext = File.extname filename
  if ext.empty?
    return filename
  end
  strip_extensions(File.basename(filename, ext))
end