/usr/lib/ruby/vendor_ruby/ramaze/files.rb is in ruby-ramaze 2012.12.08-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | module Ramaze
##
# Class that makes it possible to easily use multiple public directories in
# your Ramaze application.
#
# @author Michael Fellinger
# @since 14-03-2009
#
class Files
##
# Creates a new instance of the class, stores the given root directories
# and syncs the changes with Rack::Cascade.
#
# @author Michael Fellinger
# @since 14-03-2009
# @param [Array] roots A set of root directories that contain a number of
# public directories.
#
def initialize(*roots)
@roots = roots.flatten.map{|root| File.expand_path(root.to_s) }
sync
end
##
# Allows this class to be called as a Rack middleware.
#
# @author Michael Fellinger
# @since 14-03-2009
# @param [Hash] env Hash containing all the environment details.
#
def call(env)
@cascade.call(env)
end
##
# Adds a new path to the list of root directories.
#
# @author Michael Fellinger
# @since 14-03-2009
# @param [String] path The path to add to the existing root directories.
#
def <<(path)
@roots << File.expand_path(path.to_s)
@roots.uniq!
sync
end
##
# Syncs the class with Rack::Cascade.
#
# @author Michael Fellinger
# @since 14-03-2009
#
def sync
file_apps = @roots.map { |root| Rack::File.new(root) }
@cascade = Rack::Cascade.new(file_apps)
end
end # Files
end # Ramaze
|