Sha256: 6a5b0deb126ae98456a7c0e8498b6d5631806e8b87c6a84f14d94ad850823e57

Contents?: true

Size: 397 Bytes

Versions: 3

Compression:

Stored size: 397 Bytes

Contents

# frozen_string_literal: true

module ActiveRecordDoctor
  module Logger
    class Hierarchical # :nodoc:
      def initialize(io)
        @io = io
        @nesting = 0
      end

      def log(message)
        @io.puts(("  " * @nesting) + message.to_s)
        return if !block_given?

        @nesting += 1
        result = yield
        @nesting -= 1
        result
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_record_doctor-1.15.0 lib/active_record_doctor/logger/hierarchical.rb
active_record_doctor-1.14.0 lib/active_record_doctor/logger/hierarchical.rb
active_record_doctor-1.13.0 lib/active_record_doctor/logger/hierarchical.rb