class Graphiti::Scoping::ExtraAttributes

Public Instance Methods

apply() click to toggle source

Loop through all requested extra fields. If custom scoping logic is define for that field, run it. Otherwise, do nothing.

@return the scope object we are chaining/modofying

# File lib/graphiti/scoping/extra_attributes.rb, line 7
def apply
  each_extra_attribute do |callable|
    @scope = callable.call(@scope, resource.context)
  end

  @scope
end

Private Instance Methods

each_extra_field() { |callable| ... } click to toggle source
# File lib/graphiti/scoping/extra_attributes.rb, line 17
def each_extra_field
  resource.extra_fields.each_pair do |name, callable|
    if extra_fields.include?(name)
      yield callable
    end
  end
end
extra_fields() click to toggle source
# File lib/graphiti/scoping/extra_attributes.rb, line 25
def extra_fields
  query_hash[:extra_fields][resource.type] || []
end