Class: Ramaze::Files
Overview
Serving multiple public directories made easy.
Instance Method Summary collapse
- #<<(path) ⇒ Object
- #call(env) ⇒ Object
-
#initialize(*roots) ⇒ Files
constructor
A new instance of Files.
- #sync ⇒ Object
Constructor Details
#initialize(*roots) ⇒ Files
Returns a new instance of Files.
4 5 6 7 |
# File 'lib/ramaze/files.rb', line 4 def initialize(*roots) @roots = roots.flatten.map{|root| File.(root.to_s) } sync end |
Instance Method Details
#<<(path) ⇒ Object
13 14 15 16 17 |
# File 'lib/ramaze/files.rb', line 13 def <<(path) @roots << File.(path.to_s) @roots.uniq! sync end |
#call(env) ⇒ Object
9 10 11 |
# File 'lib/ramaze/files.rb', line 9 def call(env) @cascade.call(env) end |
#sync ⇒ Object
19 20 21 22 |
# File 'lib/ramaze/files.rb', line 19 def sync file_apps = @roots.map{|root| Rack::File.new(root) } @cascade = Rack::Cascade.new(file_apps) end |