Sha256: 6a84b90089b32e4fa29fa258e13e27ecca4122bd1789e6fbf22f18828b3857c8

Contents?: true

Size: 566 Bytes

Versions: 8

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

require_relative 'errors'

module Loaf
  # A mixin to validate configuration options
  module OptionsValidator
    # Check if options are valid or not
    #
    # @param [Hash] options
    #
    # @return [Boolean]
    #
    # @api public
    def valid?(options)
      valid_options = Loaf::Configuration::VALID_ATTRIBUTES
      options.each_key do |key|
        unless valid_options.include?(key)
          fail Loaf::InvalidOptions.new(key, valid_options)
        end
      end
      true
    end
  end # OptionsValidator
end # Loaf

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
loaf-0.10.0 lib/loaf/options_validator.rb
loaf-0.9.0 lib/loaf/options_validator.rb
loaf-0.8.1 lib/loaf/options_validator.rb
loaf-0.8.0 lib/loaf/options_validator.rb
loaf-0.7.0 lib/loaf/options_validator.rb
loaf-0.6.2 lib/loaf/options_validator.rb
loaf-0.6.1 lib/loaf/options_validator.rb
loaf-0.6.0 lib/loaf/options_validator.rb