Module: ThinkingSphinx::HashExcept

Defined in:
lib/thinking_sphinx/rails_additions.rb

Instance Method Summary collapse

Instance Method Details

#except(*keys) ⇒ Object

Returns a new hash without the given keys.



4
5
6
7
# File 'lib/thinking_sphinx/rails_additions.rb', line 4

def except(*keys)
  rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
  reject { |key,| rejected.include?(key) }
end

#except!(*keys) ⇒ Object

Replaces the hash without only the given keys.



10
11
12
# File 'lib/thinking_sphinx/rails_additions.rb', line 10

def except!(*keys)
  replace(except(*keys))
end