提交 b11ebf1d 编写于 作者: E Erik Michaels-Ober

Replace map.flatten(1) with flat_map

上级 401787db
......@@ -121,9 +121,9 @@ def missing_keys(route, parts)
def possibles(cache, options, depth = 0)
cache.fetch(:___routes) { [] } + options.find_all { |pair|
cache.key?(pair)
}.map { |pair|
}.flat_map { |pair|
possibles(cache[pair], options, depth + 1)
}.flatten(1)
}
end
# Returns +true+ if no missing keys are present, otherwise +false+.
......
......@@ -120,11 +120,11 @@ def states
end
def transitions
@string_states.map { |from, hash|
@string_states.flat_map { |from, hash|
hash.map { |s, to| [from, s, to] }
}.flatten(1) + @regexp_states.map { |from, hash|
} + @regexp_states.flat_map { |from, hash|
hash.map { |s, to| [from, s, to] }
}.flatten(1)
}
end
private
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册