Module: ArelExtensions::Comparators

Included in:
Attributes, Nodes::Soundex
Defined in:
lib/arel_extensions/comparators.rb

Instance Method Summary collapse

Instance Method Details

#!~(other) ⇒ Object

NOT_REGEXP function Negation of Regexp



33
34
35
36
37
38
# File 'lib/arel_extensions/comparators.rb', line 33

def !~(other)
#      arg = self.relation.engine.connection.schema_cache.columns_hash(self.relation.table_name)[self.name.to_s].type
#      if arg == :string || arg == :text
    Arel::Nodes::NotRegexp.new self, convert_regexp(other)
#      end
end

#<(other) ⇒ Object



13
14
15
# File 'lib/arel_extensions/comparators.rb', line 13

def <(other)
  Arel::Nodes::LessThan.new self, Arel::Nodes.build_quoted(other, self)
end

#<=(other) ⇒ Object



17
18
19
# File 'lib/arel_extensions/comparators.rb', line 17

def <=(other)
  Arel::Nodes::LessThanOrEqual.new self, Arel::Nodes.build_quoted(other, self)
end

#=~(other) ⇒ Object

REGEXP function Pattern matching using regular expressions



24
25
26
27
28
29
# File 'lib/arel_extensions/comparators.rb', line 24

def =~(other)
#      arg = self.relation.engine.connection.schema_cache.columns_hash(self.relation.table_name)[self.name.to_s].type
#      if arg == :string || arg == :text
    Arel::Nodes::Regexp.new self, convert_regexp(other)
#      end
end

#>(other) ⇒ Object



5
6
7
# File 'lib/arel_extensions/comparators.rb', line 5

def >(other)
  Arel::Nodes::GreaterThan.new self, Arel::Nodes.build_quoted(other, self)
end

#>=(other) ⇒ Object



9
10
11
# File 'lib/arel_extensions/comparators.rb', line 9

def >=(other)
  Arel::Nodes::GreaterThanOrEqual.new self, Arel::Nodes.build_quoted(other, self)
end