Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #14240 from sferik/flat_map

Replace map.flatten(1) with flat_map
  • Loading branch information...
commit f1601073de55deb78d041645e74b04c4969345d7 2 parents 401787d + b11ebf1
José Valim josevalim authored
4 actionpack/lib/action_dispatch/journey/formatter.rb
View
@@ -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+.
6 actionpack/lib/action_dispatch/journey/gtg/transition_table.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.