Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/maliq/system_extensions.rb
Instance Method Summary collapse
Instance Method Details
#basename_with(ext) ⇒ Object
7 8 9 |
# File 'lib/maliq/system_extensions.rb', line 7 def basename_with(ext) "#{File.basename(self, '.*')}.#{ext}" end |
#ext ⇒ Object
11 12 13 |
# File 'lib/maliq/system_extensions.rb', line 11 def ext File.extname(self)[/\w+$/] end |
#~ ⇒ Object
2 3 4 5 |
# File 'lib/maliq/system_extensions.rb', line 2 def ~ margin = scan(/^ +/).map(&:size).min gsub(/^ {#{margin}}/, '') end |