Sha256: 2e135ec83485c94fe45c929e821542ae658b75ecca867ff689b4b3396ca951b8

Contents?: true

Size: 646 Bytes

Versions: 5

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

module RubySmart
  module SimpleLogger
    module Devices
      class NullDevice
        attr_reader :status

        def initialize
          @status = true
        end

        def write(*)
          nil
        end

        alias_method :<<, :write

        # disables writing
        def close
          @status = false
        end

        # enables writing
        def reopen
          @status = true
        end

        # clears all logs
        def clear!
          nil
        end

        # returns logs
        # @return [Array] logs
        def logs
          []
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby_smart-simple_logger-1.5.3 lib/ruby_smart/simple_logger/devices/null_device.rb
ruby_smart-simple_logger-1.5.2 lib/ruby_smart/simple_logger/devices/null_device.rb
ruby_smart-simple_logger-1.5.1 lib/ruby_smart/simple_logger/devices/null_device.rb
ruby_smart-simple_logger-1.5.0 lib/ruby_smart/simple_logger/devices/null_device.rb
ruby_smart-simple_logger-1.4.0 lib/ruby_smart/simple_logger/devices/null_device.rb