Sha256: 028bcc35d38289688903d74155043408762ca942375593d11090f1fd7b34bae1
Contents?: true
Size: 532 Bytes
Versions: 2
Compression:
Stored size: 532 Bytes
Contents
# borrowed from http://titusd.co.uk/2010/01/31/regular-expressions-in-sqlite/ module SQLite3ARRegexp module Extension extend ActiveSupport::Concern included do def initialize(db, logger, config) super db.create_function('regexp', 2) do |func, pattern, expression| regexp = Regexp.new(pattern.to_s, Regexp::IGNORECASE) if expression.to_s.match(regexp) func.result = 1 else func.result = 0 end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sqlite3_ar_regexp-1.0.1 | lib/sqlite3_ar_regexp/extension.rb |
sqlite3_ar_regexp-1.0.0 | lib/sqlite3_ar_regexp/extension.rb |