Class: MVCLI::Router::Route
- Inherits:
-
Object
- Object
- MVCLI::Router::Route
- Defined in:
- lib/mvcli/router.rb
Instance Method Summary collapse
-
#initialize(router, pattern, action, options = {}) ⇒ Route
constructor
A new instance of Route.
- #match(argv) ⇒ Object
Constructor Details
#initialize(router, pattern, action, options = {}) ⇒ Route
Returns a new instance of Route.
65 66 67 68 |
# File 'lib/mvcli/router.rb', line 65 def initialize(router, pattern, action, = {}) @pattern = Pattern.new pattern.to_s @router, @action, = router, action, end |
Instance Method Details
#match(argv) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/mvcli/router.rb', line 70 def match(argv) argv = MVCLI::Argv.new argv match = @pattern.match(argv.arguments) if match.matches? @router.actions.new match, @action end end |