class SQLConditional::BasicCond
Internal class which represents a basic logical operation.
Constants
- LHS
- MIDDLE
- RHS
Public Class Methods
new( operator, type, *objects )
click to toggle source
# File lib/sqlconditional.rb, line 168 def initialize ( operator, type, *objects ) @operator, @type, @objects = operator.to_s, type, objects @string = nil end
Public Instance Methods
to_s()
click to toggle source
# File lib/sqlconditional.rb, line 173 def to_s return @string if @string @string = " " if @objects.empty? @string += " " + @operator + " " else case @type when LHS @string = @operator + " " + @objects[0].to_s when RHS @string = @objects[0].to_s + " " + @operator when MIDDLE @string = @objects.empty? ? " " + @operator + " " : @objects.join( " " + @operator + " " ) else raise NameError, ERR_UNKNOWN_OPERATOR_TYPE end end end