Method: Pathname#include?

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

#include?(pattern, *opts) ⇒ Boolean

Does a directory contain a matching entry? Or if the pathname is a file, same as #fnmatch.

TODO: Move to own file? Better name?

Returns [Pathname]

Returns:

  • (Boolean)


35
36
37
38
39
40
41
# File 'lib/standard/facets/pathname/glob.rb', line 35

def include?(pattern,*opts)
  if directory?
    glob_first(pattern,*opts)
  else
    fnmatch(pattern,*opts)
  end
end