Module: Loaf::OptionsValidator

Included in:
ViewExtensions
Defined in:
lib/loaf/options_validator.rb

Overview

A mixin to validate configuration options

Instance Method Summary collapse

Instance Method Details

#valid?(options) ⇒ Boolean

Check if options are valid or not

Parameters:

  • options (Hash)

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
# File 'lib/loaf/options_validator.rb', line 15

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