Class: IoMonitor::Configuration
- Inherits:
-
Object
- Object
- IoMonitor::Configuration
- Defined in:
- lib/io_monitor/configuration.rb
Constant Summary collapse
- DEFAULT_WARN_THRESHOLD =
0.0
Instance Attribute Summary collapse
-
#adapters ⇒ Object
Returns the value of attribute adapters.
-
#publisher ⇒ Object
readonly
Returns the value of attribute publisher.
-
#warn_threshold ⇒ Object
Returns the value of attribute warn_threshold.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #publish=(value) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 |
# File 'lib/io_monitor/configuration.rb', line 7 def initialize @publisher = LogsPublisher.new @adapters = [ActiveRecordAdapter.new] @warn_threshold = DEFAULT_WARN_THRESHOLD end |
Instance Attribute Details
#adapters ⇒ Object
Returns the value of attribute adapters.
13 14 15 |
# File 'lib/io_monitor/configuration.rb', line 13 def adapters @adapters end |
#publisher ⇒ Object (readonly)
Returns the value of attribute publisher.
13 14 15 |
# File 'lib/io_monitor/configuration.rb', line 13 def publisher @publisher end |
#warn_threshold ⇒ Object
Returns the value of attribute warn_threshold.
13 14 15 |
# File 'lib/io_monitor/configuration.rb', line 13 def warn_threshold @warn_threshold end |
Instance Method Details
#publish=(value) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/io_monitor/configuration.rb', line 15 def publish=(value) if value.is_a?(BasePublisher) @publisher = value elsif (publisher_type = resolve(IoMonitor::PUBLISHERS, value)) @publisher = publisher_type.new else supported = IoMonitor::PUBLISHERS.map(&:kind) raise ArgumentError, "Only the following publishers are supported: #{supported}." end end |