lib/rails/graphql/type_map.rb
# Iterate over the types of the given +base_class+ that are defined on the
# given +namespaces+.
Iterate over the types of the given +base_class+ that are defined on the
given +namespaces+.
Iterate over the types of the given + base_class + that are defined on the given + namespaces + .
def each_from(namespaces, base_class: :Type, exclusive: false, &block)
        register_pending!
        namespaces = namespaces.is_a?(Set) ? namespaces.to_a : Array.wrap(namespaces)
        namespaces += [:base] unless namespaces.include?(:base) || exclusive
        iterated = Set.new
        enumerator = Enumerator::Lazy.new(namespaces.uniq) do |yielder, item|
          next unless @index.key?(item)
          @index[item][base_class]&.each do |_key, value|
            next if (value = value.call).blank? || iterated.include?(value.gql_name)
            iterated << value.gql_name
            yielder << value
          end
        end
        block.present? ? enumerator.each(&block) : enumerator
      end
def each_from ( namespaces , base_class : :Type , exclusive : false , & block ) register_pending! namespaces = namespaces . is_a? ( Set ) ? namespaces . to_a : Array . wrap ( namespaces ) namespaces += [ :base ] unless namespaces . include? ( :base ) || exclusive iterated = Set . new enumerator = Enumerator :: Lazy . new ( namespaces . uniq ) do | yielder , item | next unless @index . key? ( item ) @index [ item ] [ base_class ] &. each do | _key , value | next if ( value = value . call ) . blank? || iterated . include? ( value . gql_name ) iterated << value . gql_name yielder << value end end block . present? ? enumerator . each ( & block ) : enumerator end
Iterate over the types of the given +base_class+ that are defined on the
given +namespaces+.
Iterate over the types of the given + base_class + that are defined on the given + namespaces + .
# Only iterate over string based types
namespaces
base_class
exclusive
block