Module: ActiveRecord::Refined::AST::Predications

Included in:
Aggregate, Column, Function
Defined in:
lib/active_record/refined/ast.rb

Overview

Predicate builders shared by symbols, qualified columns and expressions. Imported into the Symbol refinement with Refinement#import_methods, so every method must be defined with def.

Instance Method Summary collapse

Instance Method Details

#!=(other) ⇒ Object



12
13
14
# File 'lib/active_record/refined/ast.rb', line 12

def !=(other)
  Comparison.new(self, :!=, other)
end

#!~(pattern) ⇒ Object



36
37
38
# File 'lib/active_record/refined/ast.rb', line 36

def !~(pattern)
  Match.new(self, pattern, negated: true)
end

#<(other) ⇒ Object



24
25
26
# File 'lib/active_record/refined/ast.rb', line 24

def <(other)
  Comparison.new(self, :<, other)
end

#<=(other) ⇒ Object



28
29
30
# File 'lib/active_record/refined/ast.rb', line 28

def <=(other)
  Comparison.new(self, :<=, other)
end

#==(other) ⇒ Object



8
9
10
# File 'lib/active_record/refined/ast.rb', line 8

def ==(other)
  Comparison.new(self, :==, other)
end

#=~(pattern) ⇒ Object



32
33
34
# File 'lib/active_record/refined/ast.rb', line 32

def =~(pattern)
  Match.new(self, pattern)
end

#>(other) ⇒ Object



16
17
18
# File 'lib/active_record/refined/ast.rb', line 16

def >(other)
  Comparison.new(self, :>, other)
end

#>=(other) ⇒ Object



20
21
22
# File 'lib/active_record/refined/ast.rb', line 20

def >=(other)
  Comparison.new(self, :>=, other)
end

#between?(min, max) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/active_record/refined/ast.rb', line 48

def between?(min, max)
  In.new(self, min..max)
end

#end_with?(suffix) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/active_record/refined/ast.rb', line 60

def end_with?(suffix)
  Like.new(self, "%#{Like.escape(suffix)}", Like::ESCAPE)
end

#in?(values) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/active_record/refined/ast.rb', line 44

def in?(values)
  In.new(self, values)
end

#include?(substring) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/active_record/refined/ast.rb', line 64

def include?(substring)
  Like.new(self, "%#{Like.escape(substring)}%", Like::ESCAPE)
end

#like?(pattern) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/active_record/refined/ast.rb', line 52

def like?(pattern)
  Like.new(self, pattern)
end

#null?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/active_record/refined/ast.rb', line 40

def null?
  Comparison.new(self, :==, nil)
end

#start_with?(prefix) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/active_record/refined/ast.rb', line 56

def start_with?(prefix)
  Like.new(self, "#{Like.escape(prefix)}%", Like::ESCAPE)
end