This is for a really specific case where a hash is used as arguments to one of the map methods.
Returns an array Sexp containing the keys from the hash
# File lib/brakeman/processors/lib/rails2_route_processor.rb, line 304 def get_keys hash keys = Sexp.new(:array) hash_iterate(hash) do |key, value| keys << key end keys end
This replaces
{ :some => :hash }.keys
with
[:some]
# File lib/brakeman/processors/lib/rails2_route_processor.rb, line 290 def process_call exp process_default exp if hash? exp.target and exp.method == :keys keys = get_keys exp.target exp.clear keys.each_with_index do |e,i| exp[i] = e end end exp end
Generated with the Darkfish Rdoc Generator 2.