class Shale::Mapping::Base

Private Instance Methods

validate_arguments(key, to, using) click to toggle source

Validate correctness of argument passed to map functions

@param [String] key @param [Symbol] to @param [Hash] using

@raise [IncorrectMappingArgumentsError] when arguments are incorrect

@api private

# File lib/shale/mapping/base.rb, line 19
def validate_arguments(key, to, using)
  if to.nil? && using.nil?
    msg = ":to or :using argument is required for mapping '#{key}'"
    raise IncorrectMappingArgumentsError, msg
  end

  if !using.nil? && (using[:from].nil? || using[:to].nil?)
    msg = ":using argument for mapping '#{key}' requires :to and :from keys"
    raise IncorrectMappingArgumentsError, msg
  end
end