Different in single star(*) and double stars(**)?

Load any custom rakefile extensions

deprecated_paths =
Dir["#{RAILS_ROOT}/vendor/plugins//tasks/**/.rake"].sort

the code in rails. and what’s the different * and **?

Zhenning G. wrote:

Load any custom rakefile extensions

deprecated_paths =
Dir["#{RAILS_ROOT}/vendor/plugins//tasks/**/.rake"].sort

the code in rails. and what’s the different * and **?

There is a brief explanation in the docs for the glob method:

$ ri Dir.glob | cat
-------------------------------------------------------------- Dir::glob
Dir.glob( pattern, [flags] ) => array
Dir.glob( pattern, [flags] ) {| filename | block } => nil

  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)

  <code>*</code>:     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.

  <code>**</code>:    Matches directories recursively.

(There are also some examples… see if you can run ri to see them.)

thanks. got it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs