Class: ActiveRecord::Extensions::PostgreSQLRegexp

Inherits:
RegexpBase
  • Object
show all
Defined in:
lib/ar-extensions/extensions.rb

Overview

ActiveRecord::Extension for implementing Regexp implementation for PostgreSQL. See documention for RegexpBase.

Note: this doesn’t support case insensitive matches.

Constant Summary

Constants inherited from RegexpBase

RegexpBase::NOT_EQUAL_RGX

Class Method Summary collapse

Methods inherited from RegexpBase

field_result

Class Method Details

.process(key, val, caller) ⇒ Object



402
403
404
405
406
# File 'lib/ar-extensions/extensions.rb', line 402

def self.process( key, val, caller )
  return nil unless val.is_a?( Regexp )
  r = field_result( key, caller )
  return Result.new( "#{caller.quoted_table_name}.#{r.fieldname} #{r.negate? ? '!~ ':'~'} ?", val )
end