--- !ruby/object:RI::MethodDescription
aliases: []
block_params:
comment:
- !ruby/struct:SM::Flow::P
body: Returns the filenames found by expanding pattern which is an Array of the patterns or the pattern String, either as an array or as parameters to the block. Note that this pattern is not a regexp (it's closer to a shell glob). See File::fnmatch for the meaning of the flags parameter. Note that case sensitivity depends on your system (so File::FNM_CASEFOLD is ignored)
- !ruby/object:SM::Flow::LIST
contents:
- !ruby/struct:SM::Flow::LI
label: "*
:"
body: Matches any file. Can be restricted by other values in the glob. * will match all files; c* will match all files beginning with c; *c will match all files ending with c; and c will match all files that have c in them (including at the beginning or end). Equivalent to / .* /x in regexp.
- !ruby/struct:SM::Flow::LI
label: "**
:"
body: Matches directories recursively.
- !ruby/struct:SM::Flow::LI
label: "?
:"
body: Matches any one character. Equivalent to /.{1}/ in regexp.
- !ruby/struct:SM::Flow::LI
label: "[set]
:"
body: Matches any one character in set. Behaves exactly like character sets in Regexp, including set negation ([^a-z]).
- !ruby/struct:SM::Flow::LI
label: "{p,q}
:"
body: Matches either literal p or literal q. Matching literals may be more than one character in length. More than two literals may be specified. Equivalent to pattern alternation in regexp.
- !ruby/struct:SM::Flow::LI
label: "\\
:"
body: Escapes the next metacharacter.
type: :NOTE
- !ruby/struct:SM::Flow::VERB
body: " Dir["config.?"] #=> ["config.h"]\n Dir.glob("config.?") #=> ["config.h"]\n Dir.glob("*.[a-z][a-z]") #=> ["main.rb"]\n Dir.glob("*.[^r]*") #=> ["config.h"]\n Dir.glob("*.{rb,h}") #=> ["main.rb", "config.h"]\n Dir.glob("*") #=> ["config.h", "main.rb"]\n Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "..", "config.h", "main.rb"]\n\n rbfiles = File.join("**", "*.rb")\n Dir.glob(rbfiles) #=> ["main.rb",\n "lib/song.rb",\n "lib/song/karaoke.rb"]\n libdirs = File.join("**", "lib")\n Dir.glob(libdirs) #=> ["lib"]\n\n librbfiles = File.join("**", "lib", "**", "*.rb")\n Dir.glob(librbfiles) #=> ["lib/song.rb",\n "lib/song/karaoke.rb"]\n\n librbfiles = File.join("**", "lib", "*.rb")\n Dir.glob(librbfiles) #=> ["lib/song.rb"]\n"
full_name: Dir::glob
is_singleton: true
name: glob
params: |
Dir.glob( pattern, [flags] ) => array
Dir.glob( pattern, [flags] ) {| filename | block } => nil
visibility: public