Class: Mongo::Server::Description::Inspector::DescriptionChanged

Inherits:
Object
  • Object
show all
Includes:
Event::Publisher
Defined in:
lib/mongo/server/description/inspector/description_changed.rb

Overview

Handles inspecting the result of an ismaster command for servers added to the cluster.

Since:

  • 2.0.0

Instance Attribute Summary

Attributes included from Event::Publisher

#event_listeners

Instance Method Summary collapse

Methods included from Event::Publisher

#publish

Constructor Details

#initialize(event_listeners) ⇒ DescriptionChanged

Instantiate the server added inspection.

Examples:

Instantiate the inspection.

ServerAdded.new(listeners)

Parameters:

Since:

  • 2.0.0



35
36
37
# File 'lib/mongo/server/description/inspector/description_changed.rb', line 35

def initialize(event_listeners)
  @event_listeners = event_listeners
end

Instance Method Details

#run(description, updated) ⇒ Object

Run the server added inspection.

Examples:

Run the inspection.

ServerAdded.run(description, {})

Parameters:

Since:

  • 2.0.0



48
49
50
51
52
# File 'lib/mongo/server/description/inspector/description_changed.rb', line 48

def run(description, updated)
  unless (description.unknown? && updated.unknown?) || (description == updated)
    publish(Event::DESCRIPTION_CHANGED, description, updated)
  end
end