| 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.
| NOT_EQUAL_RGX | = | /^(.+)_(ne|not|does_not_match)$/ |
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.
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