Sha256: acbc9de1865340f77e10a9ebcc44a4852d548b422e4fbb484506e86eda99b430
Contents?: true
Size: 657 Bytes
Versions: 129
Compression:
Stored size: 657 Bytes
Contents
module ActiveMerchant #:nodoc: module RequiresParameters #:nodoc: def requires!(hash, *params) params.each do |param| if param.is_a?(Array) raise ArgumentError.new("Missing required parameter: #{param.first}") unless hash.has_key?(param.first) valid_options = param[1..-1] raise ArgumentError.new("Parameter: #{param.first} must be one of #{valid_options.to_sentence(:words_connector => 'or')}") unless valid_options.include?(hash[param.first]) else raise ArgumentError.new("Missing required parameter: #{param}") unless hash.has_key?(param) end end end end end
Version data entries
129 entries across 129 versions & 31 rubygems