Sha256: 0d776ca5bc76e17ef3898c69c3a1358d95c2184dbaa371da1bf67c943bc207a7

Contents?: true

Size: 1.34 KB

Versions: 97

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

module GraphQL
  class Schema
    class Member
      module RelayShortcuts
        def edge_type_class(new_edge_type_class = nil)
          if new_edge_type_class
            @edge_type_class = new_edge_type_class
          else
            @edge_type_class || find_inherited_value(:edge_type_class, Types::Relay::BaseEdge)
          end
        end

        def connection_type_class(new_connection_type_class = nil)
          if new_connection_type_class
            @connection_type_class = new_connection_type_class
          else
            @connection_type_class || find_inherited_value(:connection_type_class, Types::Relay::BaseConnection)
          end
        end

        def edge_type
          @edge_type ||= begin
            edge_name = self.graphql_name + "Edge"
            node_type_class = self
            Class.new(edge_type_class) do
              graphql_name(edge_name)
              node_type(node_type_class)
            end
          end
        end

        def connection_type
          @connection_type ||= begin
            conn_name = self.graphql_name + "Connection"
            edge_type_class = self.edge_type
            Class.new(connection_type_class) do
              graphql_name(conn_name)
              edge_type(edge_type_class)
            end
          end
        end
      end
    end
  end
end

Version data entries

97 entries across 97 versions & 2 rubygems

Version Path
graphql-1.12.14 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.13 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.12 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.11 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.10 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.9 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.8 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.7 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.6 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.5 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.11.8 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.4 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.3 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.2 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.1 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.12.0 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.11.7 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.11.6 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.11.5 lib/graphql/schema/member/relay_shortcuts.rb
graphql-1.11.4 lib/graphql/schema/member/relay_shortcuts.rb