Class: SmqlToAR::ConditionTypes::Functions

Inherits:
Condition
  • Object
show all
Defined in:
lib/smql_to_ar/condition_types.rb

Defined Under Namespace

Classes: Function, Order

Constant Summary collapse

Operator =
':'
Expected =
[String, Array, Hash, Numeric, nil]

Constants inherited from Condition

Condition::Where

Instance Attribute Summary

Attributes inherited from Condition

#cols, #value

Class Method Summary collapse

Methods inherited from Condition

#build, #initialize, try_parse, #verify, #verify_allowed, #verify_column

Constructor Details

This class inherits a constructor from SmqlToAR::ConditionTypes::Condition

Class Method Details

.new(model, col, val) ⇒ Object



311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/smql_to_ar/condition_types.rb', line 311

def self.new model, col, val
	SmqlToAR.logger.info( { function: col.first.to_sym }.inspect)
	r = nil
	constants.each do |c|
		next  if [:Function, :Where, :Expected, :Operator].include? c
		c = const_get c
		next  if Function === c or not c.respond_to?( :try_parse)
		SmqlToAR.logger.info( {f: c}.inspect)
		r = c.try_parse model, col.first.to_sym, val
		SmqlToAR.logger.info( {r: r}.inspect)
		break  if r
	end
	r
end