Method: Subroutine::Outputs#validate_outputs!

Defined in:
lib/subroutine/outputs.rb

#validate_outputs!Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/subroutine/outputs.rb', line 58

def validate_outputs!
  output_configurations.each_pair do |name, config|
    if config.required? && !output_provided?(name)
      raise ::Subroutine::Outputs::OutputNotSetError, name
    end
    unless valid_output_type?(name)
      name = name.to_sym
      raise ::Subroutine::Outputs::InvalidOutputTypeError.new(
        name: name,
        actual_type: outputs[name].class,
        expected_type: output_configurations[name][:type]
      )
    end
  end
end