Class: Appsignal::Probes::ProbeCollection Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/probes.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initializeProbeCollection

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ProbeCollection.



10
11
12
# File 'lib/appsignal/probes.rb', line 10

def initialize
  @probes = {}
end

Instance Method Details

#[](key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Fetch a probe using its name.

Parameters:

  • key (Symbol/String)

    The name of the probe to fetch.

Returns:

  • (Object)

    Returns the registered probe.



28
29
30
# File 'lib/appsignal/probes.rb', line 28

def [](key)
  probes[key]
end

#clearvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Clears all probes from the list.



21
22
23
# File 'lib/appsignal/probes.rb', line 21

def clear
  probes.clear
end

#countInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Number of probes that are registered.

Returns:

  • (Integer)

    Number of probes that are registered.



15
16
17
# File 'lib/appsignal/probes.rb', line 15

def count
  probes.count
end

#each(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
# File 'lib/appsignal/probes.rb', line 47

def each(&block)
  probes.each(&block)
end

#internal_register(name, probe) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
37
38
39
# File 'lib/appsignal/probes.rb', line 33

def internal_register(name, probe)
  if probes.key?(name)
    logger.debug "A probe with the name `#{name}` is already " \
      "registered. Overwriting the entry with the new probe."
  end
  probes[name] = probe
end

#unregister(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/appsignal/probes.rb', line 42

def unregister(name)
  probes.delete(name)
end