class Mongo::Event::DescriptionChanged

This handles a change in description.

@since 2.0.6

Attributes

cluster[R]

@return [ Mongo::Cluster ] cluster The event publisher.

Public Class Methods

new(cluster) click to toggle source

Initialize the new host added event handler.

@example Create the new handler.

ServerAdded.new(cluster)

@param [ Mongo::Cluster ] cluster The cluster to publish from.

@since 2.0.0

# File lib/mongo/event/description_changed.rb, line 35
def initialize(cluster)
  @cluster = cluster
end

Public Instance Methods

handle(updated) click to toggle source

This event publishes an event to add the cluster and logs the configuration change.

@example Handle the event.

server_added.handle('127.0.0.1:27018')

@param [ Server::Description ] updated The changed description.

@since 2.0.0

# File lib/mongo/event/description_changed.rb, line 48
def handle(updated)
  cluster.add_hosts(updated)
  cluster.remove_hosts(updated)
end