Class: Rack::BetaSite
- Inherits:
-
Object
- Object
- Rack::BetaSite
- Includes:
- Utils
- Defined in:
- lib/bacchus/rack/beta_site.rb
Defined Under Namespace
Classes: Request
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ BetaSite
constructor
A new instance of BetaSite.
Constructor Details
#initialize(app, options = {}) ⇒ BetaSite
Returns a new instance of BetaSite.
19 20 21 22 23 24 25 |
# File 'lib/bacchus/rack/beta_site.rb', line 19 def initialize(app, = {}) @app = app @excluded_routes = [:except] || [] @access_form_routes = [:access_through] || [] @access_template_route = [:access_template] or raise "Specify the route to the template for the access form." @server = [:server] or raise "Specify the address of the server." end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
17 18 19 |
# File 'lib/bacchus/rack/beta_site.rb', line 17 def @options end |
Instance Method Details
#call(env) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bacchus/rack/beta_site.rb', line 27 def call(env) request = Request.new(env) if access_form_route?(request) request.path = @access_template_route env["PATH_INFO"] = request.path env["REQUEST_URI"] = request.fullpath render_with_bacchus(env) elsif access_denied?(request) render_locked else @app.call(env) end end |