From: Nobuyoshi Nakada <nobu@...>
Date: 2011-10-22T11:29:14+09:00
Subject: [ruby-core:40270] [Ruby 1.9 - Feature #5422] File.fnmatch != Dir.glob # {no,sets}


Issue #5422 has been updated by Nobuyoshi Nakada.


=begin
Thomas Sawyer wrote:

> I see. In that case, adding a new `File.glob_match?` (or maybe just `File.match?`) would be better.

The former doesn't sound appropriate, because "glob" does not imply brace
expansion originally.

  $ case foo in f{oo,ar}) echo ok;; *) echo ng;; esac
  ng

  $ case "f{oo,ar}" in f{oo,ar}) echo ok;; *) echo ng;; esac
  ok

> File.expand_brace won't really help here b/c it would be tied to the actual file system. Part of the usefulness of fnmatch? is that it is not.

Brace expansion is a string to array conversion operation, and not used only for file names in shell scripts.
=end

----------------------------------------
Feature #5422: File.fnmatch != Dir.glob # {no,sets}
http://redmine.ruby-lang.org/issues/5422

Author: Suraj Kurapati
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 2.0
ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]


Hello,

The File.fnmatch methods do not support Dir.glob's set notation:

>> Dir.glob '{.g,t}*'
=> [".gem", "test"]
>> File.fnmatch? '{.g,t}*', 'test'
=> false
>> File.fnmatch? '{.g,t}*', '.gem'
=> false

Please add set notation to fnmatch() and make it equal to glob().

Thanks for your consideration.


-- 
http://redmine.ruby-lang.org