lib/grape/router.rb in grape-1.3.2 vs lib/grape/router.rb in grape-1.3.3

- old
+ new

@@ -5,19 +5,10 @@ module Grape class Router attr_reader :map, :compiled - class Any < AttributeTranslator - attr_reader :pattern, :index - def initialize(pattern, index, **attributes) - @pattern = pattern - @index = index - super(attributes) - end - end - class NormalizePathCache < Grape::Util::Cache def initialize @cache = Hash.new do |h, path| normalized_path = +"/#{path}" normalized_path.squeeze!('/') @@ -62,10 +53,10 @@ map[route.request_method] << route end def associate_routes(pattern, **options) @neutral_regexes << Regexp.new("(?<_#{@neutral_map.length}>)#{pattern.to_regexp}") - @neutral_map << Any.new(pattern, @neutral_map.length, **options) + @neutral_map << Grape::Router::AttributeTranslator.new(options.merge(pattern: pattern, index: @neutral_map.length)) end def call(env) with_optimization do response, route = identity(env)