class Autoloaded::Specifications

Holds regulations for autoloading.

@since 1.3

@api private

Public Instance Methods

validate!(attribute) click to toggle source

Evaluates the specifications for conflicts, in reference to the specified attribute.

@param [Symbol] attribute the attribute (:except, :only, or :with)

being modified

@return [Specifications] the Specifications

@raise [RuntimeError] attribute is :except and #only is not empty @raise [RuntimeError] attribute is :only and #except is not empty

@see except @see only

# File lib/autoloaded/specifications.rb, line 61
def validate!(attribute)
  other_attribute = {except: :only, only: :except}[attribute]
  if other_attribute
    unless send(attribute).empty? || send(other_attribute).empty?
      raise "can't specify `#{attribute}' when `#{other_attribute}' is " +
            'already specified'
    end
  end

  self
end