Sha256: 1136ac9ba6f7465762bacccc2097786599cdf9adc71b569b742e1077f5e4102d

Contents?: true

Size: 603 Bytes

Versions: 11

Compression:

Stored size: 603 Bytes

Contents

# frozen_string_literal: true
require_relative '../../../application'

# DSL#call
module DSL
  def check(name, input = {})
    checks = Application.instance.checks
    unless checks[name]
      log("Check #{name} not found!", :error)
      return
    end
    input.each_pair { |k, v| set(k, v) }
    errors = []
    checks[name][:args].each do |i|
      errors << i if get(i) == 'NODATA'
    end
    if errors.count > 0
      log("Check #{name} => required params #{errors.join(',')}",:error)
    else
      instance_eval(&checks[name][:block])
    end
    input.each_pair { |k, v| unset(k) }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
teuton-2.1.8 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.8dev1 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.7 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.6 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.5dev lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.4 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.3 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.2 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.1 lib/teuton/case_manager/case/dsl/check.rb
teuton-2.1.0 lib/teuton/case_manager/case/dsl/check.rb
teuton-0.0.1 lib/teuton/case_manager/case/dsl/check.rb