Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

DoubleDefinitionCreatorProxy#method_missing is now defined normally.

  • Loading branch information...
commit 6d59ca732a115033590f8fc3c1c079ca63b66a99 1 parent aa8a85f
Brian Takita authored
2  benchmarks/rr_benchmark.rb
View
@@ -19,7 +19,7 @@
#
##RR.mock(o).foobar.returns("baz")
##o.foobar
-#5.times do
+#10.times do
# RR.mock(o).foobar.returns("baz")
# o.foobar
# RR.reset
12 lib/rr/double_definitions/double_definition_creator_proxy.rb
View
@@ -4,7 +4,7 @@ class DoubleDefinitionCreatorProxy
class << self
def blank_slate_methods
instance_methods.each do |m|
- unless m =~ /^_/ || m.to_s == 'object_id' || m.to_s == 'respond_to?'
+ unless m =~ /^_/ || m.to_s == 'object_id' || m.to_s == 'respond_to?' || m.to_s == 'method_missing'
alias_method "__blank_slated_#{m}", m
undef_method m
end
@@ -16,12 +16,6 @@ def initialize(creator, &block) #:nodoc:
@creator = creator
respond_to?(:class) ? self.class.blank_slate_methods : __blank_slated_class.blank_slate_methods
- class << self
- def method_missing(method_name, *args, &block)
- @creator.create(method_name, *args, &block)
- end
- end
-
if block_given?
if block.arity == 1
yield(self)
@@ -31,6 +25,10 @@ def method_missing(method_name, *args, &block)
end
end
+ def method_missing(method_name, *args, &block)
+ @creator.create(method_name, *args, &block)
+ end
+
def __creator__
@creator
end
Please sign in to comment.
Something went wrong with that request. Please try again.