Sha256: 7102fd0fc4cc7b400cb688b64643a0683fbeb2ecc5468fd11caf49ea11836b18

Contents?: true

Size: 428 Bytes

Versions: 2

Compression:

Stored size: 428 Bytes

Contents

class String

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

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

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

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ratch-0.4.1 lib/ratch/support/filename.rb
ratch-0.4.0 lib/ratch/support/filename.rb