1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Replace map.flatten(1) with flat_map

This commit is contained in:
Erik Michaels-Ober 2014-02-28 22:41:49 -08:00
parent 401787db4b
commit b11ebf1d80
2 changed files with 5 additions and 5 deletions

View file

@ -121,9 +121,9 @@ module ActionDispatch
def possibles(cache, options, depth = 0) def possibles(cache, options, depth = 0)
cache.fetch(:___routes) { [] } + options.find_all { |pair| cache.fetch(:___routes) { [] } + options.find_all { |pair|
cache.key?(pair) cache.key?(pair)
}.map { |pair| }.flat_map { |pair|
possibles(cache[pair], options, depth + 1) possibles(cache[pair], options, depth + 1)
}.flatten(1) }
end end
# Returns +true+ if no missing keys are present, otherwise +false+. # Returns +true+ if no missing keys are present, otherwise +false+.

View file

@ -120,11 +120,11 @@ module ActionDispatch
end end
def transitions def transitions
@string_states.map { |from, hash| @string_states.flat_map { |from, hash|
hash.map { |s, to| [from, s, to] } 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] } hash.map { |s, to| [from, s, to] }
}.flatten(1) }
end end
private private