Module: OptionsHelper
- Included in:
- Trackerific::Configuration, Trackerific::Service
- Defined in:
- lib/helpers/options_helper.rb
Overview
Helper for validating required options
Instance Method Summary (collapse)
-
- (Object) validate_options(options, required)
Private
Validates a list of options against a list of required options.
Instance Method Details
- (Object) validate_options(options, required)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validates a list of options against a list of required options
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/helpers/options_helper.rb', line 9 def (, required) # make sure all the required options exist required.each do |k| raise ArgumentError.new("Missing required parameter: #{k}") unless .has_key?(k) end # make sure no invalid options exist .each do |k, v| raise ArgumentError.new("Invalid parameter: #{k}") unless required.include?(k) end true end |