lib/sinatra/assetpack/options.rb
def files(match=nil)
          # memoize to save time when the filesystem is slow
          @@files_memo ||= {}
          key = "match_#{match.to_s.inspect}"
          memoed = @@files_memo[key]
          if memoed
            return memoed
          end

          # All
          # A buncha tuples
          tuples = @served.map { |prefix, local_path|
            path = File.expand_path(File.join(@app.root, local_path))
            spec = File.join(path, '**', '*')

            Dir[spec].map { |f|
              [ to_uri(f, prefix, path), f ]  unless File.directory?(f)
            }
          }.flatten.compact

          result = Hash[*tuples]
          @@files_memo[key] = result
          result
      end
# Returns the files as a hash.
Returns the files as a hash.
Returns the files as a hash .
def files(match=nil)
          @@files_memo ||= {}
          key = "match_#{match.to_s.inspect}"
          memoed = @@files_memo[key]
          if memoed
            return memoed
          end
          tuples = @served.map { |prefix, local_path|
            path = File.expand_path(File.join(@app.root, local_path))
            spec = File.join(path, '**', '*')
            Dir[spec].map { |f|
              [ to_uri(f, prefix, path), f ]  unless File.directory?(f)
            }
          }.flatten.compact
          result = Hash[*tuples]
          @@files_memo[key] = result
          result
      end
def files ( match = nil ) @@files_memo ||= { } key = "match_#{match.to_s.inspect}" memoed = @@files_memo [ key ] if memoed return memoed end tuples = @served . map { | prefix , local_path | path = File . expand_path ( File . join ( @app . root , local_path ) ) spec = File . join ( path , '**' , '*' ) Dir [ spec ] . map { | f | [ to_uri ( f , prefix , path ) , f ] unless File . directory? ( f ) } } . flatten . compact result = Hash [ * tuples ] @@files_memo [ key ] = result result end
Returns the files as a hash.
Returns the files as a hash .
# memoize to save time when the filesystem is slow # All # A buncha tuples
match