class CloudSesame::Query::Domain::ChainingBlock

Attributes

_orphan_node[R]
_return[R]
_scope[R]

Public Class Methods

new(_orphan_node, _scope, _return, _block_domain) click to toggle source
# File lib/cloud_sesame/query/domain/chaining_block.rb, line 8
def initialize(_orphan_node, _scope, _return, _block_domain)
        @_orphan_node = _orphan_node
        @_scope = _scope
        @_return = _return
        @_block_domain = _block_domain
end

Public Instance Methods

not(options = {}, &block) click to toggle source

CLAUSE: NOT

# File lib/cloud_sesame/query/domain/chaining_block.rb, line 18
def not(options = {}, &block)
        raise missing_block unless block_given?

        node = AST::Not.new _scope.context, options
        _block_domain(block)._eval _orphan_node, node, &block
        _scope << node

        _return || node
end

Private Instance Methods

_block_domain(block) click to toggle source
# File lib/cloud_sesame/query/domain/chaining_block.rb, line 30
def _block_domain(block)
        unless @_block_domain && @_block_domain._caller
                caller = block.binding.eval("self")
                @_block_domain._caller = caller
        end
        @_block_domain
end
missing_block() click to toggle source
# File lib/cloud_sesame/query/domain/chaining_block.rb, line 38
def missing_block
        Error::InvalidSyntax.new("#{ orphan_node.class::SYMBOL }.not requires a block")
end