Module: Connectors::Stats

Defined in:
lib/stubs/connectors/stats.rb

Class Method Summary collapse

Class Method Details

.class_key(klass, deconstantize = true) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/stubs/connectors/stats.rb', line 25

def self.class_key(klass, deconstantize = true)
  name = klass.name
  # Changes Connectors::GoogleDrive::Adapter to Connectors::GoogleDrive
  name = ActiveSupport::Inflector.deconstantize(name) if deconstantize
  # Changes Connectors::GoogleDrive to GoogleDrive
  name = ActiveSupport::Inflector.demodulize(name)
  # Changes GoogleDrive to google_drive
  ActiveSupport::Inflector.underscore(name)
end

.increment(key, value = 1) ⇒ Object



17
18
19
# File 'lib/stubs/connectors/stats.rb', line 17

def self.increment(key, value = 1)
  # no op
end

.measure(_key, _value = nil, &block) ⇒ Object



13
14
15
# File 'lib/stubs/connectors/stats.rb', line 13

def self.measure(_key, _value = nil, &block)
  block.call
end

.prefix_key(key) ⇒ Object



21
22
23
# File 'lib/stubs/connectors/stats.rb', line 21

def self.prefix_key(key)
  "connectors.#{key}"
end