Module: MongoQL::StringOperators
- Included in:
- Expression
- Defined in:
- lib/mongo_ql/string_operators.rb
Instance Method Summary collapse
Instance Method Details
#concat(*expressions) ⇒ Object
20 21 22 23 24 |
# File 'lib/mongo_ql/string_operators.rb', line 20 def concat(*expressions) Expression::MethodCall.new "$concat", self, ast_template: -> (target, **_args) { [target, *expressions.map { |e| to_expression(e) }] } end |
#substr(start, length) ⇒ Object
5 6 7 8 9 |
# File 'lib/mongo_ql/string_operators.rb', line 5 def substr(start, length) Expression::MethodCall.new "$substr", self, ast_template: -> (target, **_args) { [target, to_expression(start), to_expression(length)] } end |
#trim(chars) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/mongo_ql/string_operators.rb', line 11 def trim(chars) Expression::MethodCall.new "$trim", self, ast_template: -> (target, **_args) { { "input" => target, "chars" => to_expression(chars) } } end |