Class: MR::ReadModel::DynamicQueryExpression
- Inherits:
-
Object
- Object
- MR::ReadModel::DynamicQueryExpression
- Defined in:
- lib/mr/read_model/query_expression.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #apply_to(relation, params) ⇒ Object
-
#initialize(type, &block) ⇒ DynamicQueryExpression
constructor
A new instance of DynamicQueryExpression.
Constructor Details
#initialize(type, &block) ⇒ DynamicQueryExpression
Returns a new instance of DynamicQueryExpression.
35 36 37 38 |
# File 'lib/mr/read_model/query_expression.rb', line 35 def initialize(type, &block) @type = type @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
33 34 35 |
# File 'lib/mr/read_model/query_expression.rb', line 33 def block @block end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
33 34 35 |
# File 'lib/mr/read_model/query_expression.rb', line 33 def type @type end |
Instance Method Details
#apply_to(relation, params) ⇒ Object
40 41 42 |
# File 'lib/mr/read_model/query_expression.rb', line 40 def apply_to(relation, params) relation.send(@type, relation.instance_exec(params, &@block)) end |