Skip to content

Commit

Permalink
Remove dependency on activesupport for except
Browse files Browse the repository at this point in the history
Progress toward #264.
  • Loading branch information
sferik committed Jun 1, 2012
1 parent 847c018 commit 9019137
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions lib/twitter/core_ext/hash.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
class Hash

# Return a hash that includes everything but the given keys.
#
# @param keys [Array, Set]
# @return [Hash]
def except(*keys)
dup.except!(*keys)
end

# Replaces the hash without the given keys.
#
# @param keys [Array, Set]
# @return [Hash]
def except!(*keys)
keys.each{|key| delete(key)}
self
end

# Merges self with another hash, recursively
#
# @param hash [Hash] The hash to merge
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/status.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'active_support/core_ext/hash/except'
require 'twitter/base'
require 'twitter/client'
require 'twitter/core_ext/hash'
require 'twitter/creatable'
require 'twitter/entity/hashtag'
require 'twitter/entity/url'
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/user.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'active_support/core_ext/hash/except'
require 'twitter/authenticatable'
require 'twitter/base'
require 'twitter/core_ext/hash'
require 'twitter/creatable'
require 'twitter/status'

Expand Down

0 comments on commit 9019137

Please sign in to comment.