Method: Neo4j::Cypher::Context::Returnable#ret

Defined in:
lib/neo4j-cypher/context.rb

#ret(*returns, &block) ⇒ ReturnItem

Specifies a return statement. Notice that this is not needed, since the last value of the DSL block will be converted into one or more return statements.



124
125
126
127
128
129
130
# File 'lib/neo4j-cypher/context.rb', line 124

def ret(*returns, &block)
  options = returns.last.is_a?(Hash) ? returns.pop : {}
  returns = [self] if returns.empty? # return self unless not specified what to return
  returns = [RootClause::EvalContext.new(self).instance_exec(self, &block)].flatten if block
  r = Return.new(clause_list, returns, options, &block).eval_context
  (self.is_a?(RootClause::EvalContext)) ? r : self
end