Method: ImageOptim::Runner::GlobHelpers.expand_braces
- Defined in:
- lib/image_optim/runner/glob_helpers.rb
.expand_braces(original_glob) ⇒ Object
Expand curly braces in glob as fnmatch in ruby before 2.0 doesn’t support them
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/image_optim/runner/glob_helpers.rb', line 28 def (original_glob) = [] = [original_glob] while (glob = .shift) if (m = BRACE_REGEXP.match(glob)) m[2].split(',', -1).each do |variant| << "#{m[1]}#{variant}#{m[3]}" end else << glob end end .uniq end |