Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Better ruby interpreter compatibility
Browse files Browse the repository at this point in the history
This is partly a regression from a jruby fix that
has been applied some time ago

  See http://is.gd/b7fGz

Also, it solves the following issue on ruby-1.9

  Implicit argument passing of super from method
  defined by define_method()

[#1228 state:resolved]
  • Loading branch information
snusnu committed Mar 30, 2010
1 parent 35cceec commit e56dbcc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/dm-rails/railties/benchmarking_mixin.rb
Expand Up @@ -2,14 +2,15 @@ module DataMapper
module Adapters
module Benchmarking

%w(create read update delete).each do |method|

define_method method do |*args, &block|
result = nil
@runtime ||= 0
@runtime += Benchmark.ms { result = super }
result
end
%w[ create read update delete ].each do |method|
class_eval <<-RUBY, __FILE__, __LINE__
def #{method}(*args, &block)
result = nil
@runtime ||= 0
@runtime += Benchmark.ms { result = super(*args, &block) }
result
end
RUBY
end

def reset_runtime
Expand Down

0 comments on commit e56dbcc

Please sign in to comment.