Sha256: 8520616dc72648b590c5eca6914c349af76233531700abc4e366473c62e9969d

Contents?: true

Size: 840 Bytes

Versions: 43

Compression:

Stored size: 840 Bytes

Contents

module JsonapiCompliable
  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

43 entries across 43 versions & 1 rubygems

Version Path
jsonapi_compliable-0.11.34 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.33 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.32 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.31 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.30 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.29 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.28 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.27 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.26 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.25 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-1.0.alpha.2 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.24 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.23 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.22 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.21 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.20 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.19 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.18 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.17 lib/jsonapi_compliable/util/sideload.rb
jsonapi_compliable-0.11.16 lib/jsonapi_compliable/util/sideload.rb