diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-11-13 13:39:42 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-11-13 16:35:15 -0800 |
commit | df3b65081012f7e24fb44320d4febd9008dbb20c (patch) | |
tree | 5a25fb80793a472ae93479b861f1987068702956 /actionpack/lib/action_controller/metal | |
parent | fc29bff445a4845fcbcbbb96f071a49bc0258684 (diff) | |
download | rails-df3b65081012f7e24fb44320d4febd9008dbb20c.tar.gz rails-df3b65081012f7e24fb44320d4febd9008dbb20c.tar.bz2 rails-df3b65081012f7e24fb44320d4febd9008dbb20c.zip |
wrap up hash conversion in the constructor
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/params_wrapper.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index 3230c6d1b7..0234f138e8 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -75,7 +75,11 @@ module ActionController Options = Struct.new(:name, :format, :include, :exclude) do # :nodoc: def self.from_hash(hash) - new(*hash.values_at(:name, :format, :include, :exclude)) + name = hash[:name] + format = Array(hash[:format]) + include = hash[:include] && Array(hash[:include]).collect(&:to_s) + exclude = hash[:exclude] && Array(hash[:exclude]).collect(&:to_s) + new name, format, include, exclude end end @@ -187,10 +191,6 @@ module ActionController controller_name.singularize end - opts.format = Array(opts.format) - opts.include &&= Array(opts.include).collect(&:to_s) - opts.exclude &&= Array(opts.exclude).collect(&:to_s) - self._wrapper_options = opts end end |