Class: CloudSesame::Query::Domain::Block
- Inherits:
-
Object
- Object
- CloudSesame::Query::Domain::Block
- Extended by:
- ClassSpecific
- Includes:
- CloudSesame::Query::DSL::AnyTermMethods, CloudSesame::Query::DSL::AppliedFilterQuery, CloudSesame::Query::DSL::BindCaller, CloudSesame::Query::DSL::BlockStyledOperators, CloudSesame::Query::DSL::Operators, CloudSesame::Query::DSL::RangeHelper, CloudSesame::Query::DSL::ScopeAccessors
- Defined in:
- lib/cloud_sesame/query/domain/block.rb
Constant Summary
Constants included from CloudSesame::Query::DSL::AnyTermMethods
CloudSesame::Query::DSL::AnyTermMethods::DELIMITER
Instance Attribute Summary collapse
-
#_caller ⇒ Object
readonly
Returns the value of attribute _caller.
-
#_context ⇒ Object
readonly
Returns the value of attribute _context.
-
#_scopes ⇒ Object
readonly
Returns the value of attribute _scopes.
Instance Method Summary collapse
- #_block_domain(_block) ⇒ Object
- #_eval(node, _scope, _return = _scope, &block) ⇒ Object
- #_return ⇒ Object
- #_scope ⇒ Object
-
#initialize(_caller, _context) ⇒ Block
constructor
A new instance of Block.
Methods included from ClassSpecific
after_construct, construct_class, construct_module
Methods included from CloudSesame::Query::DSL::AnyTermMethods
Methods included from CloudSesame::Query::DSL::BindCaller
Methods included from CloudSesame::Query::DSL::ScopeAccessors
Methods included from CloudSesame::Query::DSL::RangeHelper
Methods included from CloudSesame::Query::DSL::Operators
#near, #phrase, #prefix, #term
Methods included from CloudSesame::Query::DSL::BlockStyledOperators
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
#_caller ⇒ Object (readonly)
Returns the value of attribute _caller.
16 17 18 |
# File 'lib/cloud_sesame/query/domain/block.rb', line 16 def _caller @_caller end |
#_context ⇒ Object (readonly)
Returns the value of attribute _context.
16 17 18 |
# File 'lib/cloud_sesame/query/domain/block.rb', line 16 def _context @_context end |
#_scopes ⇒ Object (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 |
#_return ⇒ Object
42 43 44 |
# File 'lib/cloud_sesame/query/domain/block.rb', line 42 def _return _scope end |
#_scope ⇒ Object
38 39 40 |
# File 'lib/cloud_sesame/query/domain/block.rb', line 38 def _scope _scopes[-1] end |