Class: Praxis::Router::VersionMatcher
- Inherits:
-
Object
- Object
- Praxis::Router::VersionMatcher
- Defined in:
- lib/praxis/router.rb
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(target, version: 'n/a') ⇒ VersionMatcher
constructor
A new instance of VersionMatcher.
Constructor Details
#initialize(target, version: 'n/a') ⇒ VersionMatcher
Returns a new instance of VersionMatcher.
10 11 12 13 |
# File 'lib/praxis/router.rb', line 10 def initialize(target, version: 'n/a') @target = target @version = version end |
Instance Method Details
#call(request) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/praxis/router.rb', line 15 def call(request) if request.version == @version @target.call(request) else # Version doesn't match, pass and continue request.unmatched_versions << @version throw :pass end end |