Class: ClientVersion
- Inherits:
-
Object
- Object
- ClientVersion
- Defined in:
- lib/client_version.rb,
lib/client_version/railtie.rb,
lib/client_version/version.rb
Overview
Rack middleware that adds adds a Client-Version header to every response with the value of the CLIENT_VERSION environment variable.
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, client_version = ENV['CLIENT_VERSION']) ⇒ ClientVersion
constructor
A new instance of ClientVersion.
Constructor Details
#initialize(app, client_version = ENV['CLIENT_VERSION']) ⇒ ClientVersion
Returns a new instance of ClientVersion.
7 8 9 10 |
# File 'lib/client_version.rb', line 7 def initialize(app, client_version = ENV['CLIENT_VERSION']) @app = app @client_version = client_version end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 |
# File 'lib/client_version.rb', line 12 def call(env) @app.call(env).tap do |_, headers, _| headers['Client-Version'.freeze] = @client_version if @client_version end end |