Permalink
Browse files

Extract the #to_sym call also, add documentation.

  • Loading branch information...
xaviershay committed Jul 4, 2012
1 parent dd315b4 commit ea1c4e53bbd9238d5f26918332535fd8f33d4e01
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/rspec/fire.rb
View
@@ -147,16 +147,18 @@ def with_doubled_class
protected
+ # This cache gives a decent speed up when a class is doubled a lot.
def implemented_methods(doubled_class, checked_methods)
@@_implemented_methods_cache ||= {}
+
+ # to_sym for non-1.9 compat
@@_implemented_methods_cache[[doubled_class, checked_methods]] ||=
- doubled_class.send(checked_methods)
+ doubled_class.send(checked_methods).map(&:to_sym)
end
def unimplemented_methods(doubled_class, expected_methods, checked_methods)
- # to_sym for non-1.9 compat
expected_methods -
- implemented_methods(doubled_class, checked_methods).map(&:to_sym)
+ implemented_methods(doubled_class, checked_methods)
end
def ensure_implemented(*method_names)

0 comments on commit ea1c4e5

Please sign in to comment.