aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/vendor/html-scanner
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-09-22 11:36:09 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-09-22 18:08:02 -0300
commit10a63e2a0cbdc1e8e4d7aef87afc868bd599ca94 (patch)
tree44cd43c9c084d88ad7e8a58e147766985939c444 /actionpack/lib/action_controller/vendor/html-scanner
parentf6de806537d60e94183f26cd6a16da426e84911e (diff)
downloadrails-10a63e2a0cbdc1e8e4d7aef87afc868bd599ca94.tar.gz
rails-10a63e2a0cbdc1e8e4d7aef87afc868bd599ca94.tar.bz2
rails-10a63e2a0cbdc1e8e4d7aef87afc868bd599ca94.zip
Refactor methods in html node to avoid injects.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/lib/action_controller/vendor/html-scanner')
-rw-r--r--actionpack/lib/action_controller/vendor/html-scanner/html/node.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
index 0eaad2b911..85250721e7 100644
--- a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
+++ b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
@@ -38,18 +38,14 @@ module HTML #:nodoc:
private
def keys_to_strings(hash)
- hash.keys.inject({}) do |h,k|
- h[k.to_s] = hash[k]
- h
- end
+ Hash[hash.keys.map {|k| [k.to_s, hash[k]]}]
end
def keys_to_symbols(hash)
- hash.keys.inject({}) do |h,k|
+ Hash[hash.keys.map do |k|
raise "illegal key #{k.inspect}" unless k.respond_to?(:to_sym)
- h[k.to_sym] = hash[k]
- h
- end
+ [k.to_sym, hash[k]]
+ end]
end
end