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
-
#gather_extensions(filename) ⇒ Object
Returns all extensions of a filename.
-
#strip_extensions(filename) ⇒ Object
Returns filename with all trailing extensions removed.
Instance Method Details
#gather_extensions(filename) ⇒ Object
Returns all extensions of a filename
14 15 16 17 18 19 20 21 22 |
# File 'lib/can/trash.rb', line 14 def gather_extensions(filename) exts = '' until 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
6 7 8 9 10 11 |
# File 'lib/can/trash.rb', line 6 def strip_extensions(filename) ext = File.extname filename return filename if ext.empty? strip_extensions(File.basename(filename, ext)) end |