Module: Serve::Rails
- Defined in:
- lib/serve/rails/mount.rb,
lib/serve/rails/routing.rb,
lib/serve/rails/configuration.rb,
lib/serve/rails/serve_controller.rb
Defined Under Namespace
Modules: Routing, ServeController Classes: Configuration, Mount
Class Method Summary collapse
-
.cache(request) ⇒ Object
Answer the cache for the given request.
- .configuration ⇒ Object
-
.configure {|configuration| ... } ⇒ Object
The most powerful way to configure Serve::Rails, the configuration is yielded to the provided block.
-
.find_cache(&block) ⇒ Object
Define the strategy for resolving the cache for a request.
-
.mount(route, root_path, &block) ⇒ Object
Mount a route on a directory.
Class Method Details
.cache(request) ⇒ Object
Answer the cache for the given request. Delegates to the ‘find_cache’ block, which defaults to a single cache.
38 39 40 |
# File 'lib/serve/rails/configuration.rb', line 38 def self.cache(request) configuration.find_cache(request) end |
.configuration ⇒ Object
42 43 44 |
# File 'lib/serve/rails/configuration.rb', line 42 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
The most powerful way to configure Serve::Rails, the configuration is yielded to the provided block. Multiple calls are cumulative - there is only one configuration instance.
50 51 52 |
# File 'lib/serve/rails/configuration.rb', line 50 def self.configure yield configuration end |
.find_cache(&block) ⇒ Object
Define the strategy for resolving the cache for a request. This allows applications to provide logic like cache-per-browser. The default is a single cache.
58 59 60 |
# File 'lib/serve/rails/configuration.rb', line 58 def self.find_cache(&block) configuration.define_find_cache(&block) end |
.mount(route, root_path, &block) ⇒ Object
Mount a route on a directory. This allows an application to have multiple served directories, each connected to different routes.
65 66 67 |
# File 'lib/serve/rails/configuration.rb', line 65 def self.mount(route, root_path, &block) configuration.mount(route, root_path, &block) end |