Class: Makanai::Router::Route
- Inherits:
-
Object
- Object
- Makanai::Router::Route
- Defined in:
- lib/makanai/router.rb
Constant Summary collapse
- DYNAMIC_PREFIX =
Prefix for dynamic path
':'
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#process ⇒ Object
readonly
Returns the value of attribute process.
-
#url_args ⇒ Object
readonly
Returns the value of attribute url_args.
Instance Method Summary collapse
-
#initialize(path:, process:, method:) ⇒ Route
constructor
A new instance of Route.
- #match?(path:, method:) ⇒ Boolean
Constructor Details
#initialize(path:, process:, method:) ⇒ Route
Returns a new instance of Route.
41 42 43 44 45 46 |
# File 'lib/makanai/router.rb', line 41 def initialize(path:, process:, method:) @path = path @process = process @method = method @url_args = {} end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
48 49 50 |
# File 'lib/makanai/router.rb', line 48 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
48 49 50 |
# File 'lib/makanai/router.rb', line 48 def path @path end |
#process ⇒ Object (readonly)
Returns the value of attribute process.
48 49 50 |
# File 'lib/makanai/router.rb', line 48 def process @process end |
#url_args ⇒ Object (readonly)
Returns the value of attribute url_args.
48 49 50 |
# File 'lib/makanai/router.rb', line 48 def url_args @url_args end |
Instance Method Details
#match?(path:, method:) ⇒ Boolean
50 51 52 53 |
# File 'lib/makanai/router.rb', line 50 def match?(path:, method:) build_url_args(path: path) path_match?(path) && self.method == method end |