Class: Graphiti::Util::Sideload Private

Inherits:
Object
  • Object
show all
Defined in:
lib/graphiti/util/sideload.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Class Method Summary collapse

Class Method Details

.namespace(a, b) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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[a]=b

API:

  • private



24
25
26
27
28
29
30
# File 'lib/graphiti/util/sideload.rb', line 24

def self.namespace(a, b)
  if a.to_s.split(".")[0] == b.to_s
    :"#{a}.#{b}"
  else
    b
  end
end