Class: C3s::NodeTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/pubsub/nodetracker.rb

Constant Summary collapse

@@existing_nodes =

The existing nodes that node tracker knows of

[]

Class Method Summary collapse

Class Method Details

.add_node(node) ⇒ Object

Adds a node to the existing nodes

node
String

the node name



10
11
12
# File 'lib/pubsub/nodetracker.rb', line 10

def self.add_node(node)
  @@existing_nodes << node
end

.include?(node) ⇒ Boolean

Checks if a node already exists on node list

node
String

the node name

Returns:

  • (Boolean)


17
18
19
# File 'lib/pubsub/nodetracker.rb', line 17

def self.include?(node)
  @@existing_nodes.include?(node)
end

.nodesObject

Returns the existing nodes



30
31
32
# File 'lib/pubsub/nodetracker.rb', line 30

def self.nodes
  @@existing_nodes
end

.remove_node(node) ⇒ Object

Removes a node from the node list

node
String

the node name



24
25
26
# File 'lib/pubsub/nodetracker.rb', line 24

def self.remove_node(node)
  @@existing_nodes.delete(node)
end