Sha256: 84ade2e3f3da1d63193b30e7bf68f4d8ae423b5fa5b8ceb1e24ebdcf9f76f324

Contents?: true

Size: 550 Bytes

Versions: 2

Compression:

Stored size: 550 Bytes

Contents

# encoding: utf-8

require 'loaf/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

2 entries across 2 versions & 1 rubygems

Version Path
loaf-0.5.0 lib/loaf/options_validator.rb
loaf-0.4.0 lib/loaf/options_validator.rb