@private
@private
Used internally to support `module_exec` in Ruby 1.8.6.
# File lib/rspec/core/extensions/module_eval_with_args.rb, line 11 11: def module_eval_with_args(*args, &block) 12: # ruby > 1.8.6 13: return module_exec(*args, &block) if respond_to?(:module_exec) 14: 15: # If there are no args and the block doesn't expect any, there's no 16: # need to fake module_exec with our hack below. 17: # Notes: 18: # * lambda { }.arity # => -1 19: # * lambda { || }.arity # => 0 20: # * lambda { |*a| }.arity # => -1 21: return module_eval(&block) if block.arity < 1 && args.size.zero? 22: 23: orig_singleton_methods = singleton_methods 24: instance_eval_with_args(*args, &block) 25: 26: # The only difference between instance_eval and module_eval is static method defs. 27: # * `def foo` in instance_eval defines a singleton method on the instance 28: # * `def foo` in class/module_eval defines an instance method for the class/module 29: # Here we deal with this difference by defining an instance method for 30: # each new singleton method. 31: # This has the side effect of duplicating methods (all new class methods will 32: # become instance methods and vice versa), but I don't see a way around it... 33: (singleton_methods - orig_singleton_methods).each { |m| define_method(m, &method(m)) } 34: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.