class Hanami::Routing::Namespace
Namespace
for routes. Implementation of Hanami::Router#namespace
@since 0.1.0
@api private
Public Class Methods
new(router, name, &blk)
click to toggle source
@api private @since 0.1.0
# File lib/hanami/routing/namespace.rb, line 17 def initialize(router, name, &blk) @router = router @name = Utils::PathPrefix.new(name) __setobj__(@router) instance_eval(&blk) end
Public Instance Methods
delete(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 50 def delete(path, options = {}, &endpoint) super(@name.join(path), options, &endpoint) end
get(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 26 def get(path, options = {}, &endpoint) super(@name.join(path), options, &endpoint) end
mount(app, options)
click to toggle source
@api private @since 1.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 86 def mount(app, options) super(app, options.merge(at: @name.join(options[:at]))) end
namespace(name, &blk)
click to toggle source
Supports nested namespaces @api private @since 0.1.0
# File lib/hanami/routing/namespace.rb, line 93 def namespace(name, &blk) Routing::Namespace.new(self, name, &blk) end
options(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 62 def options(path, options = {}, &endpoint) super(@name.join(path), options, &endpoint) end
patch(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 44 def patch(path, options = {}, &endpoint) super(@name.join(path), options, &endpoint) end
post(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 32 def post(path, options = {}, &endpoint) super(@name.join(path), options, &endpoint) end
put(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 38 def put(path, options = {}, &endpoint) super(@name.join(path), options, &endpoint) end
redirect(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 80 def redirect(path, options = {}, &endpoint) super(@name.join(path), options.merge(to: @name.join(options[:to])), &endpoint) end
resource(name, options = {})
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 68 def resource(name, options = {}) super name, options.merge(namespace: @name.relative_join(options[:namespace])) end
resources(name, options = {})
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 74 def resources(name, options = {}) super name, options.merge(namespace: @name.relative_join(options[:namespace])) end
trace(path, options = {}, &endpoint)
click to toggle source
@api private @since 0.1.0
Calls superclass method
# File lib/hanami/routing/namespace.rb, line 56 def trace(path, options = {}, &endpoint) super(@name.join(path), options, &endpoint) end