# File lib/fakefs/dir.rb, line 97 def self.glob(pattern, _flags = 0, &block) matches_for_pattern = lambda do |matcher| [FileSystem.find(matcher) || []].flatten.map do |e| if Dir.pwd.match(%r{\A/?\z}) || !e.to_s.match(%r{\A#{Dir.pwd}/?}) e.to_s else e.to_s.match(%r{\A#{Dir.pwd}/?}).post_match end end.sort end files = if pattern.is_a?(Array) pattern.map do |matcher| matches_for_pattern.call matcher end.flatten else matches_for_pattern.call pattern end block_given? ? files.each { |file| block.call(file) } : files end