Class: MongoQL::Expression::MethodCall
- Inherits:
-
MongoQL::Expression
- Object
- MongoQL::Expression
- MongoQL::Expression::MethodCall
- Defined in:
- lib/mongo_ql/expression/method_call.rb
Constant Summary
Constants inherited from MongoQL::Expression
Constants included from CollectionOperators
CollectionOperators::AGGREGATE_OPS
Constants included from UnaryOperators
Constants included from BinaryOperators
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#ast_template ⇒ Object
Returns the value of attribute ast_template.
-
#method ⇒ Object
Returns the value of attribute method.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(method, target, ast_template: nil, **args) ⇒ MethodCall
constructor
A new instance of MethodCall.
- #to_ast ⇒ Object
Methods inherited from MongoQL::Expression
#as_date, #if_null, #then, #type
Methods included from StringOperators
Methods included from CollectionOperators
#any?, #concat_arrays, #contains, #filter, #map, #reduce
Constructor Details
#initialize(method, target, ast_template: nil, **args) ⇒ MethodCall
Returns a new instance of MethodCall.
7 8 9 10 11 12 |
# File 'lib/mongo_ql/expression/method_call.rb', line 7 def initialize(method, target, ast_template: nil, **args) @method = method @args = args @target = to_expression(target) @ast_template = ast_template end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
5 6 7 |
# File 'lib/mongo_ql/expression/method_call.rb', line 5 def args @args end |
#ast_template ⇒ Object
Returns the value of attribute ast_template.
5 6 7 |
# File 'lib/mongo_ql/expression/method_call.rb', line 5 def ast_template @ast_template end |
#method ⇒ Object
Returns the value of attribute method.
5 6 7 |
# File 'lib/mongo_ql/expression/method_call.rb', line 5 def method @method end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/mongo_ql/expression/method_call.rb', line 5 def target @target end |
Instance Method Details
#to_ast ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/mongo_ql/expression/method_call.rb', line 14 def to_ast if ast_template { method => ast_template.call(target, **args) } else { method => target } end end |