Sha256: 1d4534bf87a46809a5bef6e216991df123f5b70e0ad58421a4f94a22531e957c

Contents?: true

Size: 831 Bytes

Versions: 82

Compression:

Stored size: 831 Bytes

Contents

module Graphiti
  module Util
    # @api private
    class Sideload
      # Determine the namespace for the sideload
      #
      # In other words, given a query like
      # /things?include=a.b
      #
      # When 'a' is sideloading 'b', b's namespace is 'b'.
      #
      # However, consider a recursive tree structure:
      #
      # /things?include=children.children
      #
      # The first occurrance of "children" will have the namespace
      # "children", the second will be "children.children" and so forth.
      #
      # This is used to match up other criteria in the query:
      #
      # ?filter[children.children][a]=b
      #
      # @api private
      def self.namespace(a, b)
        if a.to_s.split(".")[0] == b.to_s
          :"#{a}.#{b}"
        else
          b
        end
      end
    end
  end
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
graphiti-1.7.6 lib/graphiti/util/sideload.rb
graphiti-1.7.5 lib/graphiti/util/sideload.rb
graphiti-1.7.4 lib/graphiti/util/sideload.rb
graphiti-1.7.3 lib/graphiti/util/sideload.rb
graphiti-1.7.2 lib/graphiti/util/sideload.rb
graphiti-1.7.1 lib/graphiti/util/sideload.rb
graphiti-1.7.0 lib/graphiti/util/sideload.rb
graphiti-1.6.4 lib/graphiti/util/sideload.rb
graphiti-1.6.3 lib/graphiti/util/sideload.rb
graphiti-1.6.2 lib/graphiti/util/sideload.rb
graphiti-1.6.1 lib/graphiti/util/sideload.rb
graphiti-1.6.0 lib/graphiti/util/sideload.rb
graphiti-1.5.3 lib/graphiti/util/sideload.rb
graphiti-1.5.2 lib/graphiti/util/sideload.rb
graphiti-1.5.1 lib/graphiti/util/sideload.rb
graphiti-1.5.0 lib/graphiti/util/sideload.rb
graphiti-1.4.0 lib/graphiti/util/sideload.rb
graphiti-1.3.9 lib/graphiti/util/sideload.rb
graphiti-1.3.8 lib/graphiti/util/sideload.rb
graphiti-1.3.7 lib/graphiti/util/sideload.rb