Sha256: f198c2b20752623edde542fd3de60eeab83da2cced46de8fd37e5092caf01d7c
Contents?: true
Size: 644 Bytes
Versions: 15
Compression:
Stored size: 644 Bytes
Contents
require_relative '../function' require_relative '../../exceptions' Dentaku::AST::Function.register(:and, :logical, lambda { |*args| if args.empty? raise Dentaku::ArgumentError.for( :too_few_arguments, function_name: 'AND()', at_least: 1, given: 0 ), 'AND() requires at least one argument' end args.all? do |arg| case arg when TrueClass true when FalseClass, nil false else raise Dentaku::ArgumentError.for( :incompatible_type, function_name: 'AND()', expect: :logical, actual: arg.class ), 'AND() requires arguments to be logical expressions' end end })
Version data entries
15 entries across 15 versions & 2 rubygems