Method: Path#add_extension
- Defined in:
- lib/path/parts.rb
#add_extension(ext) ⇒ Object Also known as: add_ext
Adds ext as an extension to path. Handle both extensions with or without leading dot. No-op if ext is empty?.
Path('file').add_extension('txt') # => #<Path file.txt>
57 58 59 60 |
# File 'lib/path/parts.rb', line 57 def add_extension(ext) return self if ext.to_s.empty? Path.new @path + Path.dotted_ext(ext) end |