BasicObject
Returns a new hash without the given keys.
# File lib/will_paginate/core_ext.rb, line 18 def except(*keys) rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) reject { |key,| rejected.include?(key) } end
Replaces the hash without only the given keys.
# File lib/will_paginate/core_ext.rb, line 24 def except!(*keys) replace(except(*keys)) end
# File lib/will_paginate/named_scope_patch.rb, line 26 def method_missing(method, *args) if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method)) super elsif @reflection.klass.scopes.include?(method) @reflection.klass.scopes[method].call(self, *args) else @reflection.klass.with_scope(:find => { :conditions => @finder_sql, :joins => @join_sql, :readonly => false }) do @reflection.klass.send(method, *args) { |*a| yield(*a) if block_given? } end end end
# File lib/will_paginate/named_scope_patch.rb, line 13 def method_missing_without_paginate(method, *args) if @reflection.klass.scopes.include?(method) @reflection.klass.scopes[method].call(self, *args) { |*a| yield(*a) if block_given? } else method_missing_without_scopes(method, *args) { |*a| yield(*a) if block_given? } end end
# File lib/will_paginate/array.rb, line 5 def paginate(options = {}) raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options WillPaginate::Collection.create( options[:page] || 1, options[:per_page] || 30, options[:total_entries] || self.length ) { |pager| pager.replace self[pager.offset, pager.per_page].to_a } end
Returns a new hash with only the given keys.
# File lib/will_paginate/core_ext.rb, line 33 def slice(*keys) allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) reject { |key,| !allowed.include?(key) } end
Generated with the Darkfish Rdoc Generator 2.