Method: Pathname#glob_first

Defined in:
lib/standard/facets/pathname/glob.rb

#glob_first(match, *opts) ⇒ Object

Return the first glob match.

DEPRECATE: While slightly faster then glob().first, not really worth it unless this can be rewritten to shortcut on first match (using fnmatch?). In wich case, is there a better name for this method?



14
15
16
17
18
# File 'lib/standard/facets/pathname/glob.rb', line 14

def glob_first(match, *opts)
  flags = glob_flags(opts)
  file = ::Dir.glob(::File.join(self.to_s, match), flags).first
  file ? self.class.new(file) : nil
end