class Mongoid::Oslc::Grammar::StringEsc

Public Instance Methods

to_mongo_query() click to toggle source
# File lib/mongoid/oslc/grammar.rb, line 70
def to_mongo_query
  value = text_value[1...-1]
  if value.starts_with?("*") || value.ends_with?("*")
    value.starts_with?("*") ? value.slice!(0)  : value.prepend("\\A")
    value.ends_with?("*")   ? value.slice!(-1) : value.concat("\\z")
    value = Regexp.new(value)
  end
  value
end