提交 84c3738c 编写于 作者: K Kasper Timm Hansen

Converge on filter.

Some places were saying filter, while others said filter_options, spare the ambiguity
and use filter throughout.

This inlines a needless local variable and clarifies a route filter consists of defaults
and values to match against.
上级 5966b801
......@@ -60,8 +60,7 @@ def initialize(routes)
end
def format(formatter, filter = nil)
filter_options = normalize_filter(filter)
routes_to_display = filter_routes(filter_options)
routes_to_display = filter_routes(normalize_filter(filter))
routes = collect_routes(routes_to_display)
if routes.none?
formatter.no_routes(collect_routes(@routes))
......@@ -89,10 +88,10 @@ def normalize_filter(filter)
end
end
def filter_routes(filter_options)
if filter_options
def filter_routes(filter)
if filter
@routes.select do |route|
filter_options.any? { |default, filter| route.defaults[default] =~ filter }
filter.any? { |default, value| route.defaults[default] =~ value }
end
else
@routes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册