Class: MR::ReadModel::DynamicQueryExpression

Inherits:
Object
  • Object
show all
Defined in:
lib/mr/read_model/query_expression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#blockObject (readonly)

Returns the value of attribute block.



33
34
35
# File 'lib/mr/read_model/query_expression.rb', line 33

def block
  @block
end

#typeObject (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