core_ext.rb

Path: lib/will_paginate/core_ext.rb
Last Update: Tue Feb 10 22:17:26 +0000 2009
dot/f_1.png

Required files

set   will_paginate/array  

Methods

except   except!   slice   slice!  

Public Instance methods

Returns a new hash without the given keys.

[Source]

    # 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.

[Source]

    # 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.

[Source]

    # 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

Replaces the hash with only the given keys.

[Source]

    # File lib/will_paginate/core_ext.rb, line 28
28:     def slice!(*keys)
29:       replace(slice(*keys))
30:     end

[Validate]