123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::Ractors::Logger::DeviceProxy

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activesupport/lib/active_support/ractors/logger/device_proxy.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(*args, **logdev_options) ⇒ DeviceProxy

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors/logger/device_proxy.rb', line 7

def initialize(*args, **logdev_options)
  @writer = Writer.spawn(*args, **logdev_options)
  @closed = false
end

Instance Method Details

#close

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors/logger/device_proxy.rb', line 24

def close
  return true if @closed

  @writer.shutdown
  @closed = true unless frozen?
  true
end

#flush

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors/logger/device_proxy.rb', line 19

def flush
  @writer.flush unless @closed
  true
end

#reopen(log = nil, **options)

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors/logger/device_proxy.rb', line 32

def reopen(log = nil, **options)
  @writer.reopen(log, options) unless @closed
  self
end

#write(message)

[ GitHub ]

  
# File 'activesupport/lib/active_support/ractors/logger/device_proxy.rb', line 12

def write(message)
  return if @closed

  @writer.async(message)
  message.bytesize
end