Class: Kangaru::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/kangaru/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace: Object) ⇒ Router

Returns a new instance of Router.



8
9
10
# File 'lib/kangaru/router.rb', line 8

def initialize(namespace: Object)
  @namespace = namespace
end

Instance Attribute Details

#namespaceObject (readonly)

Returns the value of attribute namespace.



6
7
8
# File 'lib/kangaru/router.rb', line 6

def namespace
  @namespace
end

#requestObject (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/kangaru/router.rb', line 6

def request
  @request
end

Instance Method Details

#resolve(request) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/kangaru/router.rb', line 12

def resolve(request)
  @request = request

  validate_controller_defined!
  validate_action_defined!

  controller_class.new(request).execute
end