Class: Rooq::Condition

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/rooq/condition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expression, operator, value) ⇒ void

Parameters:

  • expression (Expression)
  • operator (Symbol)
  • value (T.untyped)


23
24
25
26
27
28
# File 'lib/rooq/condition.rb', line 23

def initialize(expression, operator, value)
  @expression = expression
  @operator = operator
  @value = value
  freeze
end

Instance Attribute Details

#expressionExpression (readonly)

Returns:



14
15
16
# File 'lib/rooq/condition.rb', line 14

def expression
  @expression
end

#operatorSymbol (readonly)

Returns:

  • (Symbol)


17
18
19
# File 'lib/rooq/condition.rb', line 17

def operator
  @operator
end

#valueT.untyped (readonly)

Returns:

  • (T.untyped)


20
21
22
# File 'lib/rooq/condition.rb', line 20

def value
  @value
end

Instance Method Details

#and(other) ⇒ CombinedCondition

Parameters:

Returns:



37
38
39
# File 'lib/rooq/condition.rb', line 37

def and(other)
  CombinedCondition.new(:and, [self, other])
end

#fieldExpression

Backwards compatibility

Returns:



32
33
34
# File 'lib/rooq/condition.rb', line 32

def field
  @expression
end

#or(other) ⇒ CombinedCondition

Parameters:

Returns:



42
43
44
# File 'lib/rooq/condition.rb', line 42

def or(other)
  CombinedCondition.new(:or, [self, other])
end