Please consider the following context from Innate:
# Default application for Innate
def innate(app = Innate::DynaMap, options = Innate.options)
roots, publics = options[:roots], options[:publics]
joined = roots.map{|root| publics.map{|public| ::File.join(root, public)}}
apps = joined.flatten.map{|pr| Rack::File.new(pr) }
apps << Current.new(Route.new(app), Rewrite.new(app))
cascade(*apps)
end
My first question has to do with the following line from the above:
joined = roots.map{|root| publics.map{|public| ::File.join(root, public)}}
What is this line doing?
1 - My guess is it takes a filename and adds it to a an array caled publics and then wraps that inside another array called roots. Is this correct?
My second question has to do with this:
apps = joined.flatten.map{|pr| Rack::File.new(pr) }
apps << Current.new(Route.new(app), Rewrite.new(app))
2 - What is the purpose of "flattening" here?