diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-16 08:53:26 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-16 08:53:26 +0000 |
commit | eb1dd6a2067be548ebd4328c390d91e5abc6d81d (patch) | |
tree | 779381b9e16c4ad27c1989e7db89355bf443c31e /actionpack | |
parent | 745ea39926fcedcf63f1d25e24da229db3a03260 (diff) | |
download | rails-eb1dd6a2067be548ebd4328c390d91e5abc6d81d.tar.gz rails-eb1dd6a2067be548ebd4328c390d91e5abc6d81d.tar.bz2 rails-eb1dd6a2067be548ebd4328c390d91e5abc6d81d.zip |
Use Set instead of Array to speed up prototype helper include? calls. Closes #2880.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3055 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 11ab78938b..843f8f0614 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Use Set instead of Array to speed up prototype helper include? calls. #2880 [Stefan Kaes] + * MemCache store may be given multiple addresses. #2869 [Ryan Carver <ryan@fivesevensix.com>] * Handle cookie parsing irregularity for certain Nokia phones. #2530 [zaitzow@gmail.com] diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index ce1d3a3750..74c32c7441 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -1,4 +1,5 @@ require File.dirname(__FILE__) + '/javascript_helper' +require 'set' module ActionView module Helpers @@ -25,11 +26,12 @@ module ActionView # on the page in an Ajax response. module PrototypeHelper unless const_defined? :CALLBACKS - CALLBACKS = [ :uninitialized, :loading, :loaded, :interactive, - :complete, :failure, :success ] + (100..599).to_a - AJAX_OPTIONS = [ :before, :after, :condition, :url, :asynchronous, - :method, :insertion, :position, :form, :with, :update, - :script ] + CALLBACKS + CALLBACKS = Set.new([ :uninitialized, :loading, :loaded, + :interactive, :complete, :failure, :success ] + + (100..599).to_a) + AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url, + :asynchronous, :method, :insertion, :position, + :form, :with, :update, :script ]).merge(CALLBACKS) end # Returns a link to a remote action defined by <tt>options[:url]</tt> |