Issue #5422 has been updated by sunaku (Suraj Kurapati).


Thanks for your agreement Thomas.

Hey Ruby-core developers, we have agreed on the following API, where passing a File::FNM_EXTGLOB flag (the name "extglob" comes from the Bash/Zsh option for extended globbing) to the File.fnmatch methods enables support for Dir.glob's set notation. 

  File.fnmatch? '{.g,t}*', '.gem', File::FNM_EXTGLOB

Do you also agree on this API?  Could you please implement this for us?  If not, I'll try submitting a patch.

Thanks for your consideration.
----------------------------------------
Feature #5422: File.fnmatch != Dir.glob # {no,sets}
https://bugs.ruby-lang.org/issues/5422#change-32253

Author: sunaku (Suraj Kurapati)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: Next Major


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://bugs.ruby-lang.org/