Class: Mongoid::Oslc::Grammar::StringEsc
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Mongoid::Oslc::Grammar::StringEsc
- Defined in:
- lib/mongoid/oslc/grammar.rb
Instance Method Summary collapse
Instance Method Details
#to_mongo_query ⇒ Object
70 71 72 73 74 75 76 77 78 |
# 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 |