Sha256: ac3cc496c9637f07f1abfd3a15afa20325d8c56fdd6443e1c064c1f2a0830a56

Contents?: true

Size: 1.23 KB

Versions: 34

Compression:

Stored size: 1.23 KB

Contents

module ActiveGraph
  module Core
    class Query
      # Creates a ActiveGraph::Node::Query::QueryProxy object that builds off of a Core::Query object.
      #
      # @param [Class] model An Node 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 [ActiveGraph::Node::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.
        ActiveGraph::Node::Query::QueryProxy.new(model, nil, node: var, optional: optional, starting_query: self, chain_level: @proxy_chain_level)
      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

      # For instances where you turn a QueryProxy into a Query and then back to a QueryProxy with `#proxy_as`
      attr_accessor :proxy_chain_level
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
activegraph-11.4.0 lib/active_graph/core/query_ext.rb
activegraph-11.3.1 lib/active_graph/core/query_ext.rb
activegraph-11.3.0 lib/active_graph/core/query_ext.rb
activegraph-11.2.0 lib/active_graph/core/query_ext.rb
activegraph-11.1.0 lib/active_graph/core/query_ext.rb
activegraph-11.1.0.beta.1 lib/active_graph/core/query_ext.rb
activegraph-11.1.0.alpha.4 lib/active_graph/core/query_ext.rb
activegraph-11.1.0.alpha.3 lib/active_graph/core/query_ext.rb
activegraph-11.1.0.alpha.2 lib/active_graph/core/query_ext.rb
activegraph-11.1.0.alpha.1 lib/active_graph/core/query_ext.rb
activegraph-10.2.0.beta.1 lib/active_graph/core/query_ext.rb
activegraph-11.0.2-java lib/active_graph/core/query_ext.rb
activegraph-10.1.1 lib/active_graph/core/query_ext.rb
activegraph-11.0.1-java lib/active_graph/core/query_ext.rb
activegraph-11.0.0-java lib/active_graph/core/query_ext.rb
activegraph-10.1.0 lib/active_graph/core/query_ext.rb
activegraph-11.0.0.beta.4-java lib/active_graph/core/query_ext.rb
activegraph-10.0.2 lib/active_graph/core/query_ext.rb
activegraph-11.0.0.beta.3-java lib/active_graph/core/query_ext.rb
activegraph-11.0.0.beta.2-java lib/active_graph/core/query_ext.rb