aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorErik Michaels-Ober <sferik@gmail.com>2014-02-28 22:41:49 -0800
committerErik Michaels-Ober <sferik@gmail.com>2014-02-28 22:46:25 -0800
commitb11ebf1d80e4fb124f0ce0448cea30988256da59 (patch)
treefdf88935ef294965418b37a9a9c189e401fa5c96 /actionpack
parent401787db4bc428dce88b04e343a64c6a6c3b681c (diff)
downloadrails-b11ebf1d80e4fb124f0ce0448cea30988256da59.tar.gz
rails-b11ebf1d80e4fb124f0ce0448cea30988256da59.tar.bz2
rails-b11ebf1d80e4fb124f0ce0448cea30988256da59.zip
Replace map.flatten(1) with flat_map
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/journey/formatter.rb4
-rw-r--r--actionpack/lib/action_dispatch/journey/gtg/transition_table.rb6
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