| Path: | lib/will_paginate/core_ext.rb |
| Last Update: | Tue May 20 11:37:23 -0500 2008 |
Returns a new hash without the given keys.
# File lib/will_paginate/core_ext.rb, line 7
7: def except(*keys)
8: rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
9: reject { |key,| rejected.include?(key) }
10: end
Replaces the hash without only the given keys.
# File lib/will_paginate/core_ext.rb, line 13
13: def except!(*keys)
14: replace(except(*keys))
15: end
Returns a new hash with only the given keys.
# File lib/will_paginate/core_ext.rb, line 22
22: def slice(*keys)
23: allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
24: reject { |key,| !allowed.include?(key) }
25: end