Class | Sequel::SQL::CaseExpression |
In: |
lib/sequel/sql.rb
|
Parent: | GenericExpression |
conditions | [R] | An array of all two pairs with the first element specifying the condition and the second element specifying the result if the condition matches. |
default | [R] | The default value if no conditions match. |
expression | [R] | The expression to test the conditions against |
Create an object with the given conditions and default value. An expression can be provided to test each condition against, instead of having all conditions represent their own boolean expression.
# File lib/sequel/sql.rb, line 645 645: def initialize(conditions, default, expression=(no_expression=true; nil)) 646: raise(Sequel::Error, 'CaseExpression conditions must be a hash or array of all two pairs') unless Sequel.condition_specifier?(conditions) 647: @conditions, @default, @expression, @no_expression = conditions.to_a, default, expression, no_expression 648: end