Sha256: cc61d538b162b35628051643f54a499a8b96789af70cffae34d9054d57234f76

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module Neo4j::Core
  class Query
    # Creates a Neo4j::ActiveNode::Query::QueryProxy object that builds off of a Core::Query object.
    #
    # @param [Class] model An ActiveNode model to be used as the start of a new QueryuProxy chain
    # @param [Symbol] var The variable to be used to refer to the object from within the new QueryProxy
    # @param [Boolean] optional Indicate whether the new QueryProxy will use MATCH or OPTIONAL MATCH.
    # @return [Neo4j::ActiveNode::Query::QueryProxy] A QueryProxy object.
    def proxy_as(model, var, optional = false)
      # TODO: Discuss whether it's necessary to call `break` on the query or if this should be left to the user.
      Neo4j::ActiveNode::Query::QueryProxy.new(model, nil,  starting_query: self.break, node: var, optional: optional)
    end

    # Calls proxy_as with `optional` set true. This doesn't offer anything different from calling `proxy_as` directly but it may be more readable.
    def proxy_as_optional(model, var)
      proxy_as(model, var, true)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neo4j-4.1.2 lib/neo4j/core/query.rb
neo4j-4.1.1 lib/neo4j/core/query.rb
neo4j-4.1.0 lib/neo4j/core/query.rb