Class: MVCLI::Router::Route
- Inherits:
-
Object
- Object
- MVCLI::Router::Route
- Defined in:
- lib/mvcli/router.rb
Instance Method Summary collapse
-
#initialize(pattern, actions, action, options = {}) ⇒ Route
constructor
A new instance of Route.
- #match(command) ⇒ Object
Constructor Details
Instance Method Details
#match(command) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mvcli/router.rb', line 36 def match(command) argv = MVCLI::Argv.new command.argv match = @pattern.match(argv.arguments) if match.matches? proc do |command| action = @actions[@action] or fail "no action found for #{@action}" action.call command, match.bindings end end end |