Class: Wary::SuiteBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/wary/suite_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ SuiteBuilder

Returns a new instance of SuiteBuilder.



5
6
7
# File 'lib/wary/suite_builder.rb', line 5

def initialize(configuration)
  @checks = configuration.fetch(:checks) || []
end

Instance Method Details

#buildObject



9
10
11
12
13
14
15
16
17
# File 'lib/wary/suite_builder.rb', line 9

def build
  initialized_checks = @checks.map do |name, config|
    klass = config.fetch(:class)
    config[:name] = name
    constantize("Wary::Check::#{klass}").new(config)
  end

  Wary::CheckSuite.new(initialized_checks)
end