提交 5966b801 编写于 作者: K Kasper Timm Hansen

Simplify filter normalization.

Assume the filter is a string, if it wasn't a hash and isn't nil. Remove needless else
and rely on Ruby's default nil return.

Add spaces within hash braces.
上级 baae9525
......@@ -83,11 +83,9 @@ def format(formatter, filter = nil)
def normalize_filter(filter)
if filter.is_a?(Hash) && filter[:controller]
{controller: /#{filter[:controller].downcase.sub(/_?controller\z/, '').sub('::', '/')}/}
elsif filter.is_a?(String)
{controller: /#{filter}/, action: /#{filter}/}
else
nil
{ controller: /#{filter[:controller].downcase.sub(/_?controller\z/, '').sub('::', '/')}/ }
elsif filter
{ controller: /#{filter}/, action: /#{filter}/ }
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册