Class: Steto::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/steto/engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEngine

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

#checksObject (readonly)

Returns the value of attribute checks.



6
7
8
# File 'lib/steto/engine.rb', line 6

def checks
  @checks
end

#reportersObject (readonly)

Returns the value of attribute reporters.



6
7
8
# File 'lib/steto/engine.rb', line 6

def reporters
  @reporters
end

Instance Method Details

#checkObject



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