Path: | lib/will_paginate/core_ext.rb |
Last Update: | Tue Jan 19 01:25:15 -0600 2010 |
Returns a new hash without the given keys.
# File lib/will_paginate/core_ext.rb, line 18 18: def except(*keys) 19: rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) 20: reject { |key,| rejected.include?(key) } 21: end
Replaces the hash without only the given keys.
# File lib/will_paginate/core_ext.rb, line 24 24: def except!(*keys) 25: replace(except(*keys)) 26: end
Returns a new hash with only the given keys.
# File lib/will_paginate/core_ext.rb, line 33 33: def slice(*keys) 34: allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) 35: reject { |key,| !allowed.include?(key) } 36: end