Skip to content

Commit

Permalink
Replace map.flatten(1) with flat_map
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Mar 1, 2014
1 parent 401787d commit b11ebf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/journey/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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+.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b11ebf1

Please sign in to comment.