Class: RackStep::Route
- Inherits:
-
Object
- Object
- RackStep::Route
- Defined in:
- lib/router.rb
Overview
Represents a single route. The verb can be ‘GET’, ‘PUT’, ‘POST’ or ‘DELETE’. The path is a string with something like ‘users’, the controller is the name of the class that will process this type of request and the method parameter is the name of the method that will be executed.
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#verb ⇒ Object
Returns the value of attribute verb.
Instance Method Summary collapse
-
#id ⇒ Object
Unique id of the route (verb + path).
-
#initialize(verb, path, controller, method) ⇒ Route
constructor
A new instance of Route.
Constructor Details
#initialize(verb, path, controller, method) ⇒ Route
Returns a new instance of Route.
50 51 52 53 54 55 |
# File 'lib/router.rb', line 50 def initialize(verb, path, controller, method) @verb = verb @path = path @controller = controller @method = method end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
48 49 50 |
# File 'lib/router.rb', line 48 def controller @controller end |
#method ⇒ Object
Returns the value of attribute method.
48 49 50 |
# File 'lib/router.rb', line 48 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
48 49 50 |
# File 'lib/router.rb', line 48 def path @path end |
#verb ⇒ Object
Returns the value of attribute verb.
48 49 50 |
# File 'lib/router.rb', line 48 def verb @verb end |
Instance Method Details
#id ⇒ Object
Unique id of the route (verb + path). Eg: ‘GETuser’.
58 59 60 |
# File 'lib/router.rb', line 58 def id verb + path end |