Class: Grape::Router::NormalizePathCache
- Inherits:
-
Util::Cache
- Object
- Util::Cache
- Grape::Router::NormalizePathCache
- Defined in:
- lib/grape/router.rb
Instance Attribute Summary
Attributes inherited from Util::Cache
Instance Method Summary collapse
-
#initialize ⇒ NormalizePathCache
constructor
A new instance of NormalizePathCache.
Constructor Details
#initialize ⇒ NormalizePathCache
Returns a new instance of NormalizePathCache.
21 22 23 24 25 26 27 28 29 |
# File 'lib/grape/router.rb', line 21 def initialize @cache = Hash.new do |h, path| normalized_path = +"/#{path}" normalized_path.squeeze!('/') normalized_path.sub!(%r{/+\Z}, '') normalized_path = '/' if normalized_path.empty? h[path] = -normalized_path end end |