lib/rails/graphql/type_map.rb
# Add a item to the index and then trigger the callbacks if any
Add a item to the index and then trigger the callbacks if any
Add a item to the index and then trigger the callbacks if any
def add(namespace, base_class, key, raw_result)
          @index[namespace][base_class][key] = raw_result
          return unless callbacks.key?(key)
          result = nil
          removeables = callbacks[key].map do |callback|
            callback.call(namespace, base_class, result ||= raw_result.call)
          end
          removeables.compact.reverse_each(&callbacks[key].method(:delete_at))
          callbacks.delete(key) if callbacks[key].empty?
        end
def add ( namespace , base_class , key , raw_result ) @index [ namespace ] [ base_class ] [ key ] = raw_result return unless callbacks . key? ( key ) result = nil removeables = callbacks [ key ] . map do | callback | callback . call ( namespace , base_class , result ||= raw_result . call ) end removeables . compact . reverse_each ( & callbacks [ key ] . method ( :delete_at ) ) callbacks . delete ( key ) if callbacks [ key ] . empty? end
Add a item to the index and then trigger the callbacks if any
Add a item to the index and then trigger the callbacks if any
namespace
base_class
key
raw_result