class SystemMetrics::Config

Attributes

instruments[RW]
notification_exclude_patterns[RW]
path_exclude_patterns[RW]
store[RW]

Public Class Methods

new() click to toggle source
# File lib/system_metrics/config.rb, line 5
def initialize
  self.store = SystemMetrics::AsyncStore.new
  self.notification_exclude_patterns = []
  self.path_exclude_patterns = [/system\/metrics/, /system_metrics/]
  self.instruments = [
    SystemMetrics::Instrument::ActionController.new,
    SystemMetrics::Instrument::ActionView.new,
    SystemMetrics::Instrument::ActiveRecord.new,
    SystemMetrics::Instrument::Rack.new
  ]
end

Public Instance Methods

errors() click to toggle source
# File lib/system_metrics/config.rb, line 28
def errors
  return nil if valid?
  errors = []
  errors << 'store cannot be nil' if store.nil?
  errors << 'instruments cannot be nil' if instruments.nil?
  errors << 'notification_exclude_patterns cannot be nil' if notification_exclude_patterns.nil?
  errors << 'path_exclude_patterns cannot be nil' if path_exclude_patterns.nil?
  errors.join("\n")
end
invalid?() click to toggle source
# File lib/system_metrics/config.rb, line 21
def invalid?
  store.nil? ||
    instruments.nil? ||
    notification_exclude_patterns.nil? ||
    path_exclude_patterns.nil?
end
valid?() click to toggle source
# File lib/system_metrics/config.rb, line 17
def valid?
  !invalid?
end