Module: Rack::Halt
- Defined in:
- lib/rack/halt/version.rb,
lib/rack/halt/rule_set.rb,
lib/rack/halt/rule.rb,
lib/rack/halt.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.call(env) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/rack/halt.rb', line 17 def call(env) if matched_rule = find_first_matching_rule(env) return [404, {"Content-Type" => "text/html"}, content_for(env)] end @app.call(env) end |
.new(app, &rule_block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/rack/halt.rb', line 9 def new(app, &rule_block) @app = app @rule_set = RuleSet.new @rule_set.instance_eval(&rule_block) if block_given? self end |