Class: Ramaze::Files

### Home Classes Methods

### In Files

- lib/ramaze/files.rb

### Parent

Object

### Methods

- ::new
- #<<
- #call
- #sync

### Files

- Gemfile
- Rakefile

### Class/Module Index

Quicksearch

- Ramaze
- Ramaze::App
- Ramaze::Bin
- Ramaze::Bin::Create
- Ramaze::Bin::Runner
- Ramaze::Cache
- Ramaze::Cache::LRU
- Ramaze::Cache::LocalMemCache
- Ramaze::Cache::MemCache
- Ramaze::Cache::Redis
- Ramaze::Cache::Sequel
- Ramaze::Controller
- Ramaze::CoreExtensions
- Ramaze::CoreExtensions::Object
- Ramaze::CoreExtensions::String
- Ramaze::Current
- Ramaze::DefaultController
- Ramaze::Files
- Ramaze::Gestalt
- Ramaze::Helper
- Ramaze::Helper::Auth
- Ramaze::Helper::Bench
- Ramaze::Helper::BlueForm
- Ramaze::Helper::BlueForm::Form
- Ramaze::Helper::CSRF
- Ramaze::Helper::Cache
- Ramaze::Helper::Cache::SingletonMethods
- Ramaze::Helper::Email
- Ramaze::Helper::Erector
- Ramaze::Helper::Flash
- Ramaze::Helper::Formatting
- Ramaze::Helper::Gestalt
- Ramaze::Helper::Gravatar
- Ramaze::Helper::Identity
- Ramaze::Helper::Layout
- Ramaze::Helper::Layout::SingletonMethods
- Ramaze::Helper::Link
- Ramaze::Helper::Localize
- Ramaze::Helper::Localize::Dictionary
- Ramaze::Helper::Localize::Parser
- Ramaze::Helper::Markaby
- Ramaze::Helper::Maruku
- Ramaze::Helper::Paginate
- Ramaze::Helper::Paginate::Paginator
- Ramaze::Helper::Paginate::Paginator::ArrayPager
- Ramaze::Helper::Paginate::Paginator::DataMapperPager
- Ramaze::Helper::Remarkably
- Ramaze::Helper::RequestAccessor
- Ramaze::Helper::SendFile
- Ramaze::Helper::SimpleCaptcha
- Ramaze::Helper::Stack
- Ramaze::Helper::Thread
- Ramaze::Helper::Upload
- Ramaze::Helper::Upload::ClassMethods
- Ramaze::Helper::Upload::UploadedFile
- Ramaze::Helper::UserHelper
- Ramaze::Helper::UserHelper::Wrapper
- Ramaze::Helper::XHTML
- Ramaze::LRUHash
- Ramaze::Logger
- Ramaze::Logger::Informer
- Ramaze::Logger::LogHub
- Ramaze::Logger::Logger
- Ramaze::Logger::RotatingInformer
- Ramaze::Logger::Syslog
- Ramaze::Logging
- Ramaze::Reloader
- Ramaze::Reloader::Hooks
- Ramaze::Reloader::WatchInotify
- Ramaze::Reloader::WatchStat
- Ramaze::Request
- Ramaze::Response
- Ramaze::SpecLogger
- Ramaze::View
- Ramaze::View::Erector
- Ramaze::View::Erubis
- Ramaze::View::Ezamar
- Ramaze::View::Gestalt
- Ramaze::View::Haml
- Ramaze::View::Liquid
- Ramaze::View::Liquid::Tag
- Ramaze::View::Lokar
- Ramaze::View::Mustache
- Ramaze::View::Mustache::RamazeContext
- Ramaze::View::Nagoro
- Ramaze::View::Remarkably
- Ramaze::View::Sass
- Ramaze::View::Slippers
- Ramaze::View::Tagz
- Ramaze::View::Tagz::Methods
- Ramaze::View::Tenjin
- Innate
- Innate::View
- Innate::View::Slim
- Nagoro
- Nagoro::Pipe
- Nagoro::Pipe::RenderPartial
- Bacon
- Bacon::PrettyOutput
- Erector
- Erector::Widget
- Rack
- Rack::RouteExceptions
- Tenjin
- Tenjin::Template
- BlankSlate
- Controller
- MainController
- Object

No matching classes.

# Ramaze::Files

Class that makes it possible to easily use multiple public directories in your Ramaze application.

@author Michael Fellinger @since 14-03-2009

### Public Class Methods

new(*roots) click to toggle source

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.

    # File lib/ramaze/files.rb, line 19
    def initialize(*roots)
      @roots = roots.flatten.map{|root| File.expand_path(root.to_s) }
      sync
    end

### Public Instance Methods

<<(path) click to toggle source

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.

    # File lib/ramaze/files.rb, line 42
    def <<(path)
      @roots << File.expand_path(path.to_s)
      @roots.uniq!
      sync
    end

call(env) click to toggle source

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.

    # File lib/ramaze/files.rb, line 31
    def call(env)
      @cascade.call(env)
    end

sync() click to toggle source

Syncs the class with Rack::Cascade.

@author Michael Fellinger @since 14-03-2009

    # File lib/ramaze/files.rb, line 54
    def sync
      file_apps = @roots.map { |root| Rack::File.new(root) }
      @cascade  = Rack::Cascade.new(file_apps)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.