Permalink
Browse files

wrap up hash conversion in the constructor

  • Loading branch information...
1 parent fc29bff commit df3b65081012f7e24fb44320d4febd9008dbb20c @tenderlove tenderlove committed Nov 13, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 actionpack/lib/action_controller/metal/params_wrapper.rb
@@ -75,7 +75,11 @@ module ParamsWrapper
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 @@ def _set_wrapper_defaults(opts, model=nil)
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

0 comments on commit df3b650

Please sign in to comment.