lib/mvcli/router.rb in mvcli-0.0.6 vs lib/mvcli/router.rb in mvcli-0.0.7
- old
+ new
@@ -1,7 +1,8 @@
require "map"
-require_relative "router/pattern"
+require "mvcli/router/pattern"
+require "mvcli/argv"
module MVCLI
class Router
RoutingError = Class.new StandardError
InvalidRoute = Class.new RoutingError
@@ -31,20 +32,17 @@
@pattern = Pattern.new pattern.to_s
@actions, @action, @options = actions, action, options
end
def match(command)
- match = @pattern.match(command.argv)
+ 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
- end
-
- class Match
-
end
end
end