Class: Rack::Revision
- Inherits:
-
Object
- Object
- Rack::Revision
- Defined in:
- lib/rack/revision.rb,
lib/rack/revision/version.rb
Constant Summary collapse
- File =
::File
- VERSION =
"1.1.0"
- @@revision =
nil
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Revision
constructor
A new instance of Revision.
- #reset_revision ⇒ Object
Constructor Details
#initialize(app, options = {}) ⇒ Revision
Returns a new instance of Revision.
8 9 10 11 12 |
# File 'lib/rack/revision.rb', line 8 def initialize(app, ={}) () @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rack/revision.rb', line 14 def call(env) if @options[:rack_env] env[@options[:rack_env]] = revision end status, headers, body = @app.call(env) if @options[:header] headers[@options[:header]] = revision end [status, headers, body] end |
#reset_revision ⇒ Object
28 29 30 |
# File 'lib/rack/revision.rb', line 28 def reset_revision @@revision = nil end |