Sha256: 50f48f1a2582af47ee0e07fb442dd7fd346bcb2d9c628d00f09a1fd52af2f959

Contents?: true

Size: 429 Bytes

Versions: 5

Compression:

Stored size: 429 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

5 entries across 5 versions & 2 rubygems

Version Path
detroit-0.4.0 lib/detroit/core_ext/to_actual_filename.rb
detroit-0.3.0 lib/detroit/tool/core_ext/to_actual_filename.rb
detroit-0.2.0 lib/detroit/tool/core_ext/to_actual_filename.rb
detroit-0.1.0 lib/detroit/tool/core_ext/to_actual_filename.rb
ratch-1.2.0 lib/ratch/core_ext/to_actual_filename.rb