Class: SmqlToAR::ConditionTypes::NotInRange
- Defined in:
- lib/smql_to_ar/condition_types.rb
Constant Summary collapse
- Operator =
'!..'
- Where =
'%s NOT BETWEEN %s AND %s'
- Expected =
[Range, lambda {|val| Array === val && 2 == val.length } ]
Instance Attribute Summary
Attributes inherited from Condition
Instance Method Summary collapse
-
#initialize(model, cols, val) ⇒ NotInRange
constructor
A new instance of NotInRange.
- #not_in_range_build(builder, table) ⇒ Object (also: #build)
Methods inherited from Condition
#condition_build, inspect, #inspect, try_parse, #verify, #verify_allowed, #verify_column
Methods included from Assertion
Constructor Details
#initialize(model, cols, val) ⇒ NotInRange
Returns a new instance of NotInRange.
185 186 187 188 189 190 191 192 |
# File 'lib/smql_to_ar/condition_types.rb', line 185 def initialize model, cols, val if Array === val f, l = val f, l = Time.parse(f), Time.parse(l) if f.kind_of? String val = f..l end super model, cols, val end |
Instance Method Details
#not_in_range_build(builder, table) ⇒ Object Also known as: build
194 195 196 197 198 199 200 201 |
# File 'lib/smql_to_ar/condition_types.rb', line 194 def not_in_range_build builder, table builder.wobs (v1 = builder.vid).to_sym => @value.begin, (v2 = builder.vid).to_sym => @value.end @cols.each do |col| col.joins builder, table builder.where self.class::Where % [ builder.column( table+col.path, col.col), v1, v2] end self end |