Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move IdentityMapKeyError under Twitter::Error namespace

  • Loading branch information...
commit f1491d2fe1827140ea42b2618d0a25dc03110394 1 parent 4d5a5c3
Erik Michaels-Ober authored
3  lib/twitter/base.rb
View
@@ -1,4 +1,5 @@
require 'twitter/core_ext/kernel'
+require 'twitter/error/identity_map_key_error'
module Twitter
class Base
@@ -39,7 +40,7 @@ def self.fetch(attrs)
return object
end
return yield if block_given?
- raise Twitter::IdentityMapKeyError, 'key not found'
+ raise Twitter::Error::IdentityMapKeyError, "key not found"
end
# Stores an object in the identity map.
9 lib/twitter/error/identity_map_key_error.rb
View
@@ -0,0 +1,9 @@
+require 'twitter/error'
+
+module Twitter
+ class Error
+ # Inherit from KeyError when Ruby 1.8 compatibility is removed
+ class IdentityMapKeyError < ::IndexError
+ end
+ end
+end
3  lib/twitter/identity.rb
View
@@ -1,4 +1,5 @@
require 'twitter/base'
+require 'twitter/error/identity_map_key_error'
module Twitter
class Identity < Twitter::Base
@@ -12,7 +13,7 @@ def self.fetch(attrs)
end
return yield if block_given?
- raise Twitter::IdentityMapKeyError, 'key not found'
+ raise Twitter::Error::IdentityMapKeyError, "key not found"
end
# Stores an object in the identity map.
4 lib/twitter/identity_map.rb
View
@@ -19,8 +19,4 @@ def store(id, object)
end
- # Inherit from KeyError when Ruby 1.8 compatibility is removed
- class IdentityMapKeyError < ::IndexError
- end
-
end
2  spec/twitter/base_spec.rb
View
@@ -22,7 +22,7 @@
it "raises an error on objects that don't exist" do
lambda {
Twitter::Base.fetch(:id => 6)
- }.should raise_error(Twitter::IdentityMapKeyError)
+ }.should raise_error(Twitter::Error::IdentityMapKeyError)
end
end
2  spec/twitter/identifiable_spec.rb
View
@@ -19,7 +19,7 @@
it "raises an error on objects that don't exist" do
lambda {
Twitter::Identity.fetch(:id => 6)
- }.should raise_error(Twitter::IdentityMapKeyError)
+ }.should raise_error(Twitter::Error::IdentityMapKeyError)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.