Permalink
Browse files

Simplified Attribute.determine_type case statement with Class#singlet…

…on_class

* This method is part of the 1.9 core API, and is only available in 1.8
  because backports is a development dependency.
  • Loading branch information...
1 parent 34c55b4 commit 67918e6ee5b9d8a2aaeda402af43da200a1bfe51 @dkubb dkubb committed Jul 8, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/virtus/attribute.rb
View
@@ -25,8 +25,8 @@ def self.determine_type(class_or_name)
# first match on the Attribute singleton class first, then match
# any class, finally fallback to matching on the string
case class_or_name
- when class << Attribute::Object; self end then determine_type_from_attribute(class_or_name)
- when Class then determine_type_from_primitive(class_or_name)
+ when Attribute::Object.singleton_class then determine_type_from_attribute(class_or_name)
+ when Class then determine_type_from_primitive(class_or_name)
else
determine_type_from_string(class_or_name.to_s)
end

0 comments on commit 67918e6

Please sign in to comment.