Class ActiveRecord::Extensions::RegexpBase
In: ar-extensions/lib/ar-extensions/extensions.rb
Parent: Object

A base class for database vendor specific Regexp implementations. This is meant to be subclassed only because of the helper method(s) it provides.

Methods

Classes and Modules

Class ActiveRecord::Extensions::RegexpBase::RegexpResult

Constants

NOT_EQUAL_RGX = /^(.+)_(ne|not|does_not_match)$/

Public Class methods

Given the passed in str and caller this will return a RegexpResult object which gives the database quoted fieldname/column and can tell you whether or not the original str is indicating a negated regular expression.

Examples

 r = RegexpBase.field_result( 'id' )
 r.fieldname => # 'id'
 r.negate?   => # false

 r = RegexpBase.field_result( 'id_ne' )
 r.fieldname => # 'id'
 r.negate?   => # true

 r = RegexpBase.field_result( 'id_not' )
 r.fieldname => # 'id'
 r.negate?   => # true

 r = RegexpBase.field_result( 'id_does_not_match' )
 r.fieldname => # 'id'
 r.negate?   => # true

[Validate]