Sha256: 8c31d59c405bfaee83bad231985f492773d085b4751161d04c70dc5874512360
Contents?: true
Size: 651 Bytes
Versions: 18
Compression:
Stored size: 651 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
18 entries across 18 versions & 3 rubygems