Class: ActiveRecord::Snapshot::Logger
- Inherits:
-
Object
- Object
- ActiveRecord::Snapshot::Logger
- Defined in:
- lib/active_record/snapshot/utils/logger.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #failed ⇒ Object
- #finish ⇒ Object
-
#initialize(step) ⇒ Logger
constructor
A new instance of Logger.
- #start ⇒ Object
Constructor Details
#initialize(step) ⇒ Logger
Returns a new instance of Logger.
8 9 10 |
# File 'lib/active_record/snapshot/utils/logger.rb', line 8 def initialize(step) @step = step end |
Class Method Details
.call(*args, &block) ⇒ Object
4 5 6 |
# File 'lib/active_record/snapshot/utils/logger.rb', line 4 def self.call(*args, &block) new(*args).call(&block) end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 |
# File 'lib/active_record/snapshot/utils/logger.rb', line 12 def call start yield.tap do |success| success ? finish : failed end end |
#failed ⇒ Object
27 28 29 |
# File 'lib/active_record/snapshot/utils/logger.rb', line 27 def failed $stderr.puts "== Failed: #{@step}" end |
#finish ⇒ Object
23 24 25 |
# File 'lib/active_record/snapshot/utils/logger.rb', line 23 def finish puts "== Done" end |
#start ⇒ Object
19 20 21 |
# File 'lib/active_record/snapshot/utils/logger.rb', line 19 def start puts "== Running: #{@step}" end |