module Floodlight

Constants

VERSION

Attributes

configuration[W]

Public Class Methods

add(name, scope:, type: 'daily') click to toggle source
# File lib/floodlight.rb, line 31
def self.add(name, scope:, type: 'daily')
  if metric = metrics.find { |m| m.name == name }
    metric.scope = scope
  else
    metrics << LazyMetric.new(name, scope: scope, type: type)
  end
end
add_cumulative(name, scope) click to toggle source
# File lib/floodlight.rb, line 27
def self.add_cumulative(name, scope)
  add(name, scope: scope, type: 'cumulative')
end
add_daily(name, scope) click to toggle source
# File lib/floodlight.rb, line 23
def self.add_daily(name, scope)
  add(name, scope: scope, type: 'daily')
end
configuration() click to toggle source
# File lib/floodlight.rb, line 11
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source
# File lib/floodlight.rb, line 15
def self.configure
  yield(configuration)
end
metrics() click to toggle source
# File lib/floodlight.rb, line 19
def self.metrics
  @metrics ||= []
end
statistics_for(name, days_ago: 1) click to toggle source
# File lib/floodlight.rb, line 39
def self.statistics_for(name, days_ago: 1)
  metric = metrics.find { |m| m.name == name.to_sym }
  metric.compute(days_ago: days_ago)
rescue
  nil
end