Class: DogWatch::Monitor
- Inherits:
-
Object
- Object
- DogWatch::Monitor
- Defined in:
- lib/dogwatch/monitor.rb
Overview
Provides a container around each monitor block
Instance Attribute Summary collapse
- #client(client = nil) ⇒ DogWatch::Model::Client readonly
-
#config ⇒ Object
Returns the value of attribute config.
-
#responses ⇒ Object
readonly
Returns the value of attribute responses.
Instance Method Summary collapse
- #get ⇒ Array
- #initialize(name = nil, &block) ⇒ DogWatch::Model::Monitor constructor
- #monitor(name, &block) ⇒ Array
Constructor Details
#initialize(name = nil, &block) ⇒ DogWatch::Model::Monitor
16 17 18 19 20 21 |
# File 'lib/dogwatch/monitor.rb', line 16 def initialize(name = nil, &block) @name = name @monitors = [] @config = nil instance_exec(&block) end |
Instance Attribute Details
#client(client = nil) ⇒ DogWatch::Model::Client (readonly)
45 46 47 |
# File 'lib/dogwatch/monitor.rb', line 45 def client @client end |
#config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/dogwatch/monitor.rb', line 11 def config @config end |
#responses ⇒ Object (readonly)
Returns the value of attribute responses.
10 11 12 |
# File 'lib/dogwatch/monitor.rb', line 10 def responses @responses end |
Instance Method Details
#get ⇒ Array
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dogwatch/monitor.rb', line 33 def get @responses = @monitors.map do |m| validate = @client.validate(m) if validate.status == :error validate else @client.execute(m) end end end |