Module: Reap::Extensions::String

Included in:
String
Defined in:
lib/reap/extensions/string.rb

Overview

String Extensions

Instance Method Summary collapse

Instance Method Details

#to_actual_filenameObject

Find actual filename (casefolding) and returns it. Returns nil if no file is found.



11
12
13
# File 'lib/reap/extensions/string.rb', line 11

def to_actual_filename
  Dir.glob(self, File::FNM_CASEFOLD).first
end

#to_actual_filename!Object

Find actual filename (casefolding) and replace string with it. If file not found, string remains the same and method returns nil.



18
19
20
21
# File 'lib/reap/extensions/string.rb', line 18

def to_actual_filename!
  filename = to_actual_filename
  replace(filename) if filename
end