Sha256: 4d57cebc25912d3f6b52091c5aaf42a76575cefffa9cc18214ff4fba1f7bac7d
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
require_relative 'model/client' require_relative 'model/monitor' module DogWatch ## # Provides a container around each monitor block ## class Monitor attr_reader :client attr_reader :responses attr_accessor :config # @param [String] name # @param [Proc] block # @return [DogWatch::Model::Monitor] def initialize(name = nil, &block) @name = name @monitors = [] @config = nil instance_exec(&block) end # @param [String] name # @param [Proc] block # @return [Array] def monitor(name, &block) monitor = DogWatch::Model::Monitor.new(name) monitor.instance_eval(&block) @monitors << monitor end # @return [Array] def get @responses = @monitors.map do |m| validate = @client.validate(m) if validate.status == :error validate else @client.execute(m) end end end # @return [DogWatch::Model::Client] def client(client = nil) @client = if client.nil? DogWatch::Model::Client.new(@config) else client end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dogwatch-1.2.0 | lib/dogwatch/monitor.rb |
dogwatch-1.1.1 | lib/dogwatch/monitor.rb |
dogwatch-1.1.0 | lib/dogwatch/monitor.rb |