Sha256: 857035715bd5a6d1446ed17f85facc63d2a9e924a090abff5b93faf2e2408f08

Contents?: true

Size: 369 Bytes

Versions: 2

Compression:

Stored size: 369 Bytes

Contents

module InvalidOptions
  extend ActiveSupport::Concern

  class_methods do
    protected
    def check_and_merge_options(options, default_options)
      invalid_options = options.keys - default_options.keys
      raise ArgumentError.new("Invalid option(s): #{invalid_options}") if invalid_options.present?

      options.reverse_merge(default_options)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inherited_class_var-0.1.1 lib/inherited_class_var/invalid_options.rb
inherited_class_var-0.1.0 lib/inherited_class_var/invalid_options.rb