lib/hanami/routing/resource/nested.rb in hanami-router-1.3.2 vs lib/hanami/routing/resource/nested.rb in hanami-router-2.0.0.alpha1
- old
+ new
@@ -1,16 +1,18 @@
+# frozen_string_literal: true
+
module Hanami
module Routing
class Resource
# Helper class to calculate nested path
#
# @api private
# @since 0.4.0
class Nested
# @api private
# @since 0.4.0
- SEPARATOR = '/'.freeze
+ SEPARATOR = "/"
# @api private
# @since 0.4.0
def initialize(resource_name, resource)
@resource_name = resource_name.to_s.split(SEPARATOR)
@@ -30,9 +32,10 @@
# @api private
# @since 0.4.0
def _calculate(param_wildcard, resource = nil)
return if resource.nil?
+
@path << resource.wildcard_param(param_wildcard.pop)
_calculate(param_wildcard, resource.parent)
end
end
end