Skip to content

Commit b11ebf1

Browse files
committed
Replace map.flatten(1) with flat_map
1 parent 401787d commit b11ebf1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

actionpack/lib/action_dispatch/journey/formatter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def missing_keys(route, parts)
121121
def possibles(cache, options, depth = 0)
122122
cache.fetch(:___routes) { [] } + options.find_all { |pair|
123123
cache.key?(pair)
124-
}.map { |pair|
124+
}.flat_map { |pair|
125125
possibles(cache[pair], options, depth + 1)
126-
}.flatten(1)
126+
}
127127
end
128128

129129
# Returns +true+ if no missing keys are present, otherwise +false+.

actionpack/lib/action_dispatch/journey/gtg/transition_table.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ def states
120120
end
121121

122122
def transitions
123-
@string_states.map { |from, hash|
123+
@string_states.flat_map { |from, hash|
124124
hash.map { |s, to| [from, s, to] }
125-
}.flatten(1) + @regexp_states.map { |from, hash|
125+
} + @regexp_states.flat_map { |from, hash|
126126
hash.map { |s, to| [from, s, to] }
127-
}.flatten(1)
127+
}
128128
end
129129

130130
private

0 commit comments

Comments
 (0)