instance method
say_with_time
Ruby on Rails 8.0.4
Since v3.1.12Signature
say_with_time(message)
Outputs text along with how long it took to run its block. If the block returns an integer it assumes it is the number of rows affected.
Parameters
-
messagereq
Source
# File activerecord/lib/active_record/migration.rb, line 1018
def say_with_time(message)
say(message)
result = nil
time_elapsed = ActiveSupport::Benchmark.realtime { result = yield }
say "%.4fs" % time_elapsed, :subitem
say("#{result} rows", :subitem) if result.is_a?(Integer)
result
end
Defined in activerecord/lib/active_record/migration.rb line 1018
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Migration