Class: OMQ::MonitorEvent

Inherits:
Data
  • Object
show all
Defined in:
lib/omq/constants.rb

Overview

Lifecycle event emitted by Socket#monitor.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, endpoint: nil, detail: nil) ⇒ MonitorEvent

Returns a new instance of MonitorEvent.



29
# File 'lib/omq/constants.rb', line 29

def initialize(type:, endpoint: nil, detail: nil) = super

Instance Attribute Details

#detailHash? (readonly)

Returns extra context (e.g. { error: }, { interval: }, etc.).

Returns:

  • (Hash, nil)

    extra context (e.g. { error: }, { interval: }, etc.)



28
29
30
# File 'lib/omq/constants.rb', line 28

MonitorEvent = Data.define(:type, :endpoint, :detail) do
  def initialize(type:, endpoint: nil, detail: nil) = super
end

#endpointString? (readonly)

Returns the endpoint involved.

Returns:

  • (String, nil)

    the endpoint involved



28
29
30
# File 'lib/omq/constants.rb', line 28

MonitorEvent = Data.define(:type, :endpoint, :detail) do
  def initialize(type:, endpoint: nil, detail: nil) = super
end

#typeSymbol (readonly)

Returns event type (:listening, :connected, :disconnected, etc.).

Returns:

  • (Symbol)

    event type (:listening, :connected, :disconnected, etc.)



28
29
30
# File 'lib/omq/constants.rb', line 28

MonitorEvent = Data.define(:type, :endpoint, :detail) do
  def initialize(type:, endpoint: nil, detail: nil) = super
end