core_ext.rb

Path: lib/will_paginate/core_ext.rb
Last Update: Tue Jan 19 01:25:15 -0600 2010
Array dot/f_7.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 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.

[Source]

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

[Source]

    # 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

Replaces the hash with only the given keys.

[Source]

    # File lib/will_paginate/core_ext.rb, line 39
39:     def slice!(*keys)
40:       replace(slice(*keys))
41:     end

[Validate]