Sha256: a8cee7f5b16c5257b110c85e9cffdea1ce176542c367db5e3d38a0fce68da4f1

Contents?: true

Size: 930 Bytes

Versions: 21

Compression:

Stored size: 930 Bytes

Contents

module CloudSesame
	module Query
		module Domain
			class ChainingBlock

				attr_reader :_orphan_node, :_scope, :_return

				def initialize(_orphan_node, _scope, _return, _block_domain)
					@_orphan_node = _orphan_node
					@_scope = _scope
					@_return = _return
					@_block_domain = _block_domain
				end

				# CLAUSE: NOT
				# =========================================

				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

				def _block_domain(block)
					@_block_domain ||= (
						caller = block.binding.eval("self")
						Domain::Block.new caller, _scope.context
					)
				end

				def missing_block
					Error::InvalidSyntax.new("#{ orphan_node.class::SYMBOL }.not requires a block")
				end

			end
		end
	end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
CloudSesame-0.7.5 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.7.4 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.7.3 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.7.2 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.7.1 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.7.0 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.8 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.7 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.6 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.5 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.4 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.3 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.2 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.1 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.6.0 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.5.5 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.5.4 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.5.3 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.5.2 lib/cloud_sesame/query/domain/chaining_block.rb
CloudSesame-0.5.1 lib/cloud_sesame/query/domain/chaining_block.rb