Method: Sequel::SQL::CaseExpression#initialize
- Defined in:
- lib/sequel/sql.rb
#initialize(conditions, default, expression = (no_expression=true; nil)) ⇒ CaseExpression
Create an object with the given conditions and default value, and optional expression. An expression can be provided to test each condition against, instead of having all conditions represent their own boolean expression.
1213 1214 1215 1216 1217 1218 1219 1220 |
# File 'lib/sequel/sql.rb', line 1213 def initialize(conditions, default, expression=(no_expression=true; nil)) raise(Sequel::Error, 'CaseExpression conditions must be a hash or array of all two pairs') unless Sequel.condition_specifier?(conditions) @conditions = conditions.to_a.dup.freeze @default = default @expression = expression @no_expression = no_expression freeze end |