Sha256: 0559f414111664e19b6440d3241bc8af3f5f2bd3032304976c5cc242a274368f

Contents?: true

Size: 581 Bytes

Versions: 8

Compression:

Stored size: 581 Bytes

Contents

module Reap
module Extensions

  # String Extensions

  module 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

end
end

class String #:nodoc:
  include Reap::Extensions::String
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reap-9.2.1 lib/reap/extensions/string.rb
reap-9.2.0 lib/reap/extensions/string.rb
reap-9.3.3 lib/reap/extensions/string.rb
reap-9.4.0 lib/reap/extensions/string.rb
reap-9.3.4 lib/reap/extensions/string.rb
reap-9.3.0 lib/reap/extensions/string.rb
reap-9.3.5 lib/reap/extensions/string.rb
reap-9.3.1 lib/reap/extensions/string.rb