Skip to content
Permalink
Browse files

Add docs for ActiveRecord::Migration#say, #say_with_time, #suppress_m…

…essages [ci skip]
  • Loading branch information...
nsgc committed Jun 18, 2018
1 parent a865f62 commit 3c63f1e02159dfc728602ac9881d4b852759d514
Showing with 5 additions and 0 deletions.
  1. +5 −0 activerecord/lib/active_record/migration.rb
@@ -831,10 +831,14 @@ def announce(message)
write "== %s %s" % [text, "=" * length]
end

# Takes a message argument and outputs it as is.
# A second boolean argument can be passed to specify whether to indent or not.
def say(message, subitem = false)
write "#{subitem ? " ->" : "--"} #{message}"
end

# 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.
def say_with_time(message)
say(message)
result = nil
@@ -844,6 +848,7 @@ def say_with_time(message)
result
end

# Takes a block as an argument and suppresses any output generated by the block.
def suppress_messages
save, self.verbose = verbose, false
yield

0 comments on commit 3c63f1e

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.