Class: Steto::Engine
- Inherits:
-
Object
- Object
- Steto::Engine
- Defined in:
- lib/steto/engine.rb
Instance Attribute Summary collapse
-
#checks ⇒ Object
readonly
Returns the value of attribute checks.
-
#reporters ⇒ Object
readonly
Returns the value of attribute reporters.
Instance Method Summary collapse
- #check ⇒ Object
- #config(&block) ⇒ Object
-
#initialize ⇒ Engine
constructor
A new instance of Engine.
- #report(reporter = nil) ⇒ Object
Constructor Details
#initialize ⇒ Engine
Returns a new instance of Engine.
8 9 10 11 |
# File 'lib/steto/engine.rb', line 8 def initialize @checks = [] @reporters = [] end |
Instance Attribute Details
#checks ⇒ Object (readonly)
Returns the value of attribute checks.
6 7 8 |
# File 'lib/steto/engine.rb', line 6 def checks @checks end |
#reporters ⇒ Object (readonly)
Returns the value of attribute reporters.
6 7 8 |
# File 'lib/steto/engine.rb', line 6 def reporters @reporters end |
Instance Method Details
#check ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/steto/engine.rb', line 19 def check Parallel.each(checks, :in_threads => 4) do |check| begin check.check rescue => e check.status = :unknown check.text = e.to_s end end self end |
#config(&block) ⇒ Object
13 14 15 16 17 |
# File 'lib/steto/engine.rb', line 13 def config(&block) @config ||= Config.new(self) @config.configure(&block) if block_given? @config end |
#report(reporter = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/steto/engine.rb', line 31 def report(reporter = nil) if reporter reporter.report(checks) else reporters.each do |reporter| report reporter end end self end |