Sha256: 22d14ed4eb4c0d92562dc5847d46082cbec4327823897a2ffd0851e5cc6f4776

Contents?: true

Size: 469 Bytes

Versions: 10

Compression:

Stored size: 469 Bytes

Contents

module OptionsManager
  def require_options(options, required_params)
    missing_args = []
    required_params.each do |param|
      missing_args << param.to_s if  options[param].nil?
    end
    raise ArgumentError, "Missing required argument: #{missing_args.join(',')}" unless missing_args.empty?
  end

  def validate_option_in_list(option, list)
    raise ArgumentError, "Option: #{option} should be one of #{list.inspect}" unless list.include?(option)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cloudster-2.20.0 lib/cloudster/options_manager.rb
cloudster-2.19.7 lib/cloudster/options_manager.rb
cloudster-2.19.6 lib/cloudster/options_manager.rb
cloudster-2.19.5 lib/cloudster/options_manager.rb
cloudster-2.19.4 lib/cloudster/options_manager.rb
cloudster-2.19.3 lib/cloudster/options_manager.rb
cloudster-2.19.2 lib/cloudster/options_manager.rb
cloudster-2.19.1 lib/cloudster/options_manager.rb
cloudster-2.19.0 lib/cloudster/options_manager.rb
cloudster-2.18.0 lib/cloudster/options_manager.rb