lib/bindata/base.rb
# Ensures that +params+ is of the form expected by #initialize.
Ensures that +params+ is of the form expected by #initialize.
Ensures that + params + is of the form expected by #initialize .
def sanitize_parameters!(sanitizer, params)
        if params.has_key?(:readwrite)
          warn ":readwrite is deprecated. Replacing with :onlyif"
          params[:onlyif] = params.delete(:readwrite)
        end
        bindata_default_parameters.each do |k,v|
          params[k] = v unless params.has_key?(k)
        end
        bindata_mandatory_parameters.each do |prm|
          if not params.has_key?(prm)
            raise ArgumentError, "parameter ':#{prm}' must be specified " +
                                 "in #{self}"
          end
        end
        bindata_mutually_exclusive_parameters.each do |param1, param2|
          if params.has_key?(param1) and params.has_key?(param2)
            raise ArgumentError, "params #{param1} and #{param2} " +
                                 "are mutually exclusive"
          end
        end
      end
def sanitize_parameters! ( sanitizer , params ) if params . has_key? ( :readwrite ) warn ":readwrite is deprecated. Replacing with :onlyif" params [ :onlyif ] = params . delete ( :readwrite ) end bindata_default_parameters . each do | k , v | params [ k ] = v unless params . has_key? ( k ) end bindata_mandatory_parameters . each do | prm | if not params . has_key? ( prm ) raise ArgumentError , "parameter ':#{prm}' must be specified " + "in #{self}" end end bindata_mutually_exclusive_parameters . each do | param1 , param2 | if params . has_key? ( param1 ) and params . has_key? ( param2 ) raise ArgumentError , "params #{param1} and #{param2} " + "are mutually exclusive" end end end
Ensures that +params+ is of the form expected by #initialize.
Ensures that + params + is of the form expected by #initialize .
# replace :readwrite with :onlyif # add default parameters # ensure mandatory parameters exist # ensure mutual exclusion
sanitizer
<not_specific>
params
<not_specific>