Class: SystemMetrics::Config
- Inherits:
-
Object
- Object
- SystemMetrics::Config
- Defined in:
- lib/system_metrics/config.rb
Instance Attribute Summary collapse
-
#instruments ⇒ Object
Returns the value of attribute instruments.
-
#notification_exclude_patterns ⇒ Object
Returns the value of attribute notification_exclude_patterns.
-
#path_exclude_patterns ⇒ Object
Returns the value of attribute path_exclude_patterns.
-
#store ⇒ Object
Returns the value of attribute store.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #invalid? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 12 13 14 15 |
# 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 |
Instance Attribute Details
#instruments ⇒ Object
Returns the value of attribute instruments.
3 4 5 |
# File 'lib/system_metrics/config.rb', line 3 def instruments @instruments end |
#notification_exclude_patterns ⇒ Object
Returns the value of attribute notification_exclude_patterns.
3 4 5 |
# File 'lib/system_metrics/config.rb', line 3 def notification_exclude_patterns @notification_exclude_patterns end |
#path_exclude_patterns ⇒ Object
Returns the value of attribute path_exclude_patterns.
3 4 5 |
# File 'lib/system_metrics/config.rb', line 3 def path_exclude_patterns @path_exclude_patterns end |
#store ⇒ Object
Returns the value of attribute store.
3 4 5 |
# File 'lib/system_metrics/config.rb', line 3 def store @store end |
Instance Method Details
#errors ⇒ Object
28 29 30 31 32 33 34 35 36 |
# 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? ⇒ Boolean
21 22 23 24 25 26 |
# File 'lib/system_metrics/config.rb', line 21 def invalid? store.nil? || instruments.nil? || notification_exclude_patterns.nil? || path_exclude_patterns.nil? end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/system_metrics/config.rb', line 17 def valid? !invalid? end |