Class: CloudSesame::Query::Domain::Block

Constant Summary

Constants included from CloudSesame::Query::DSL::AnyTermMethods

CloudSesame::Query::DSL::AnyTermMethods::DELIMITER

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassSpecific

after_construct, construct_class, construct_module

Methods included from CloudSesame::Query::DSL::AnyTermMethods

#any_term

Methods included from CloudSesame::Query::DSL::BindCaller

#_caller=

Methods included from CloudSesame::Query::DSL::ScopeAccessors

#scopes

Methods included from CloudSesame::Query::DSL::RangeHelper

#gt, #gte, #lt, #lte

Methods included from CloudSesame::Query::DSL::Operators

#near, #phrase, #prefix, #term

Methods included from CloudSesame::Query::DSL::BlockStyledOperators

#and, #or

Methods included from CloudSesame::Query::DSL::AppliedFilterQuery

#applied?, #applied_filters, #excluded?, #included?

Constructor Details

#initialize(_caller, _context) ⇒ Block

Returns a new instance of Block.



18
19
20
21
22
# File 'lib/cloud_sesame/query/domain/block.rb', line 18

def initialize(_caller, _context)
  self._caller = _caller
  @_context = _context
  @_scopes = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CloudSesame::Query::DSL::BindCaller

Instance Attribute Details

#_callerObject (readonly)

Returns the value of attribute _caller.



16
17
18
# File 'lib/cloud_sesame/query/domain/block.rb', line 16

def _caller
  @_caller
end

#_contextObject (readonly)

Returns the value of attribute _context.



16
17
18
# File 'lib/cloud_sesame/query/domain/block.rb', line 16

def _context
  @_context
end

#_scopesObject (readonly)

Returns the value of attribute _scopes.



16
17
18
# File 'lib/cloud_sesame/query/domain/block.rb', line 16

def _scopes
  @_scopes
end

Instance Method Details

#_block_domain(_block) ⇒ Object



46
47
48
# File 'lib/cloud_sesame/query/domain/block.rb', line 46

def _block_domain(_block)
  self
end

#_eval(node, _scope, _return = _scope, &block) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cloud_sesame/query/domain/block.rb', line 24

def _eval(node, _scope, _return = _scope, &block)
  _scopes.push node

  # must build the subtree before push (<<) to it's
  # parents (_scope) in order for the parent properly
  # propagate message down to all the children.
  # ===============================================
  instance_eval(&block)
  _scope << node

  _scopes.pop
  _scope.is_a?(AST::Root) ? _return : node
end

#_returnObject



42
43
44
# File 'lib/cloud_sesame/query/domain/block.rb', line 42

def _return
  _scope
end

#_scopeObject



38
39
40
# File 'lib/cloud_sesame/query/domain/block.rb', line 38

def _scope
  _scopes[-1]
end