diff options
author | Erik Michaels-Ober <sferik@gmail.com> | 2014-02-28 22:41:49 -0800 |
---|---|---|
committer | Erik Michaels-Ober <sferik@gmail.com> | 2014-02-28 22:46:25 -0800 |
commit | b11ebf1d80e4fb124f0ce0448cea30988256da59 (patch) | |
tree | fdf88935ef294965418b37a9a9c189e401fa5c96 /actionpack/lib/action_dispatch | |
parent | 401787db4bc428dce88b04e343a64c6a6c3b681c (diff) | |
download | rails-b11ebf1d80e4fb124f0ce0448cea30988256da59.tar.gz rails-b11ebf1d80e4fb124f0ce0448cea30988256da59.tar.bz2 rails-b11ebf1d80e4fb124f0ce0448cea30988256da59.zip |
Replace map.flatten(1) with flat_map
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/formatter.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/journey/gtg/transition_table.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/journey/formatter.rb b/actionpack/lib/action_dispatch/journey/formatter.rb index 4410c1b5d5..57f0963731 100644 --- a/actionpack/lib/action_dispatch/journey/formatter.rb +++ b/actionpack/lib/action_dispatch/journey/formatter.rb @@ -121,9 +121,9 @@ module ActionDispatch 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+. diff --git a/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb b/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb index 5a79059ed6..a5b19fcf06 100644 --- a/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb +++ b/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb @@ -120,11 +120,11 @@ module ActionDispatch 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 |